Get RULE condition and commands

Started by Vlad Arkhipovalmost 14 years ago3 messagesgeneral
Jump to latest
#1Vlad Arkhipov
arhipov@dc.baikal.ru

What is the proper way of getting RULE condition and commands? The query
below does not work.

select pg_get_expr(ev_qual, ev_class, true) as condition,
pg_get_expr(ev_action, ev_class, true) as commands
from pg_rewrite;

ERROR: bogus varno: 2

********** Error **********

ERROR: bogus varno: 2
SQL state: XX000

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Vlad Arkhipov (#1)
Re: Get RULE condition and commands

Vlad Arkhipov <arhipov@dc.baikal.ru> writes:

What is the proper way of getting RULE condition and commands?

pg_get_ruledef()

regards, tom lane

#3Vlad Arkhipov
arhipov@dc.baikal.ru
In reply to: Tom Lane (#2)
Re: Get RULE condition and commands

On 06/16/2012 02:20 AM, Tom Lane wrote:

Vlad Arkhipov<arhipov@dc.baikal.ru> writes:

What is the proper way of getting RULE condition and commands?

pg_get_ruledef()

regards, tom lane

It prints the whole CREATE RULE command. Is there any way to extract
WHERE condition of the rule?