| From: | James Robinson <jlrobins(at)socialserve(dot)com> |
|---|---|
| To: | Igor Neyman <ineyman(at)perceptron(dot)com> |
| Cc: | Melvin Davidson <melvin6925(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Way to get at parsed trigger 'WHEN' clause expression? |
| Date: | 2016-03-25 19:19:00 |
| Message-ID: | 6818DA0F-65A7-431D-A086-BD0DC6B0CDFB@socialserve.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
> On Mar 25, 2016, at 3:02 PM, Igor Neyman <ineyman(at)perceptron(dot)com> 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(at)jlr-photo(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jernigan, Kevin | 2016-03-25 21:15:18 | Re: PostgreSQL advocacy |
| Previous Message | Igor Neyman | 2016-03-25 19:02:29 | Re: Way to get at parsed trigger 'WHEN' clause expression? |