Re: Way to get at parsed trigger 'WHEN' clause expression?

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: Way to get at parsed trigger 'WHEN' clause expression?
Дата
Msg-id A76B25F2823E954C9E45E32FA49D70ECCD687E3A@mail.corp.perceptron.com
обсуждение исходный текст
Ответ на Re: Way to get at parsed trigger 'WHEN' clause expression?  (Melvin Davidson <melvin6925@gmail.com>)
Список pgsql-general

Did you mean something like

SELECT substring(pg_get_triggerdef(tg.oid, TRUE) FROM position('WHEN' in pg_get_triggerdef(tg.oid, TRUE))) AS when_cond
  FROM pg_trigger tg WHERE tg.tgname = 'your_trigger_name';


--

Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.
http://us.i1.yimg.com/us.yimg.com/i/mesg/tsmileys2/01.gif

 

 

This doesn’t answer OP question.

Besides this query gets you not only “WHEN” clause but also whatever follows it, for instance “EXECUTE PROCEDURE…”

 

As for “pg_get_expr(pg_node_tree, relation_oid)” – looks like it doesn’t work with pg_trigger, because as a second parameter (Var) it expects relation_oid, and relation could have multiple triggers, so pg_get_expr() wouldn’t know which trigger’s tgqual you want to decompile.

 

Regards,

Igor Neyman

В списке pgsql-general по дате отправления:

Предыдущее
От: Geoff Winkless
Дата:
Сообщение: Re: More correlated (?) index woes
Следующее
От: Igor Neyman
Дата:
Сообщение: Re: Way to get at parsed trigger 'WHEN' clause expression?