Re: [NOVICE] Drop or disable or bypass "_return" rule on select on a view. - Mailing list pgsql-sql

From Shashwat Arghode
Subject Re: [NOVICE] Drop or disable or bypass "_return" rule on select on a view.
Date
Msg-id CAGgbXsxMqCumtzkUyBDAUNQA=XZOkA3E-UNdQjP+uFA3EVc-oQ@mail.gmail.com
Whole thread Raw
In response to Re: [NOVICE] Drop or disable or bypass "_return" rule on select on a view.  (Vincenzo Campanella <vinz65@gmail.com>)
Responses Re: [NOVICE] Drop or disable or bypass "_return" rule on select on a view.
List pgsql-sql
Hi Vincenzo,
There is no option like disable rule in alter view documentation.
Still after trying it, it gives same error as follows.

ERROR:  "viewname" is not a table

Thanks,
Shashwat.

On Thu, May 28, 2015 at 2:49 PM, Vincenzo Campanella <vinz65@gmail.com> wrote:
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



pgsql-sql by date:

Previous
From: Shashwat Arghode
Date:
Subject: Drop or disable or bypass "_return" rule on select on a view.
Next
From: Faisal Karim
Date:
Subject: Re: [NOVICE] Drop or disable or bypass "_return" rule on select on a view.