Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yxu6X-0002va-T1 for pgsql-novice@arkaria.postgresql.org; Thu, 28 May 2015 09:27:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yxu6W-0007jr-Sz for pgsql-novice@arkaria.postgresql.org; Thu, 28 May 2015 09:27:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yxu6V-0007jg-Qh; Thu, 28 May 2015 09:27:56 +0000 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Yxu6N-000674-Ps; Thu, 28 May 2015 09:27:54 +0000 Received: by wizk4 with SMTP id k4so139732971wiz.1; Thu, 28 May 2015 02:27:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=C8nsOU8zoTgoYK8oijvUh6iWGagZlfNwSQ1zk5aFYkA=; b=UGgfkq1I8ASYLTm89i52ZdGaX/eI1a094fEKbq6Kow29g9dypUbC1s2rjj580ktkGo /ZSL6X0sN/zbHvSYH0/R10Ig6bx2W9OirlBQ7krYQDYaxJUbYEiNLX8/EEMsf8OWetM3 ieEQjk4ReyAj61fis2rV5HMOJPooIpP4nVIUV/MrrK0aPKv72pjZcNraybZqulXmTD5y gME54pMSfPBBO+tR418YFI34LA11KnRHqjD8VhDVPyn5EjzOnCrrk+LWiBTyPzGwEQTN AY4znB8gB4crPrifyPJ9K7+HNvgY1n9x38ja5xZriLIK7xTloc7cmoFX77RXn4rmh+I1 oFVg== X-Received: by 10.180.107.138 with SMTP id hc10mr14130132wib.2.1432804805348; Thu, 28 May 2015 02:20:05 -0700 (PDT) Received: from [192.168.1.150] (194.0.192.178.dynamic.wline.res.cust.swisscom.ch. [178.192.0.194]) by mx.google.com with ESMTPSA id ez19sm7566579wid.19.2015.05.28.02.20.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 02:20:04 -0700 (PDT) Message-ID: <5566DDBE.5040304@gmail.com> Date: Thu, 28 May 2015 11:19:58 +0200 From: Vincenzo Campanella User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Shashwat Arghode , pgsql-novice@postgresql.org, pgsql-sql@postgresql.org Subject: Re: Drop or disable or bypass "_return" rule on select on a view. References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-novice Precedence: bulk Sender: pgsql-novice-owner@postgresql.org Il 28.05.2015 08:23, Shashwat Arghode ha scritto: > Hi all, > I am using postgres 9.3.4 and have an on_select rule "_return" on a view. > I want to drop or disable or bypass that rule. > Is there any way it can be done without dropping the view?? > > Because when i try to drop it, it returns > > ERROR: cannot drop rule _RETURN on view viewname because view > viewname requires it > HINT: You can drop viewname instead. > CONTEXT: SQL statement "drop rule "_RETURN" on viewname" > PL/pgSQL function inline_code_block line 12 at EXECUTE statement > > and i don't want to drop the view. > > when i try to disable it using : > alter table viewname disable rule _return > it returns > ERROR: "viewname" is not a table > > > Bypassing rule for a single query or disabling it for some time and > then enable it will also work for me. > > Can it be done ? > > Thanks, > Shashwat. Hi Shashwat I am no PG guru but I guess that, since "viewname" is a view and not a table, you should use "alter view" and not "alter table". See: http://www.postgresql.org/docs/9.3/static/sql-alterview.html -- Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-novice