Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Mar 25, 2016, at 3:02 PM, Igor Neyman <ineyman@xxxxxxxxxxxxxx> wrote:
> 
> James,
> 
> Instead of pg_catalog, you could use INFORMATION_SCHEMA to get "WHEN" clause:
> 
> select action_condition from information_schema.triggers where trigger_name = 'your_trigger_name';
> 
> Regards,
> Igor

Hah, good suggestion. Looking into how *it* is implemented (on 9.2 at least), brings us back to string manipulation of the result of pg_get_triggerdef():

\d+ information_schema.triggers
...
"substring"(pg_get_triggerdef(t.oid), "position"("substring"(pg_get_triggerdef(t.oid), 48), 'EXECUTE PROCEDURE'::text) + 47)::information_schema.character_data AS action_statement,
...

But at least we can turn a blind eye to its internal horror. Thanks!

-------
James Robinson
james@xxxxxxxxxxxxx





-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux