From: | Susan Hurst <susan(dot)hurst(at)brookhurstdata(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Calling function (table_name, schema_name) within event trigger |
Date: | 2015-12-27 20:32:56 |
Message-ID: | 73fcd7229ebdaa928e9eb6ce72eb527d@mail.brookhurstdata.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2015-12-27 13:19, Tom Lane wrote:
> Andreas Kretschmer <andreas(at)a-kretschmer(dot)de> writes:
>> The problem is, that tg_table_name isn't declared within a event
>> trigger.
>> TG_TAG is defined, it contains the command, for instance CREATE TABLE.
>
> Yeah. According to
> http://www.postgresql.org/docs/9.4/static/plpgsql-trigger.html#PLPGSQL-EVENT-TRIGGER
> only TG_TAG and TG_EVENT are defined inside PL/pgSQL event triggers.
>
> So at present, you can only do very coarse event recording using
> PL/pgSQL; if you want to do anything interesting you have to resort
> to writing your event trigger in C. (And I think that even then,
> 9.4 did not offer very complete facilities for finding out what the
> DDL command had done; 9.5 will provide more info.)
>
> regards, tom lane
hmmmm...well, Tom, at least you saved me a lot of frustration with
trying to get this to work :-) For the time being, I'll just follow up
DDL activity with a procedure that compares diffs between
information_schema and the history tables. If and when pl/pgsql offers
the capture of DDL activity on the fly, I can just move my code to an
event trigger.
Thanks for your help!
Sue
---
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Susan E Hurst
Principal Consultant
Email: susan(dot)hurst(at)brookhurstdata(dot)com
Mobile: 314-486-3261
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2015-12-27 20:36:40 | Re: Calling function (table_name, schema_name) within event trigger |
Previous Message | Andreas Kretschmer | 2015-12-27 20:14:22 | Re: Calling function (table_name, schema_name) within event trigger |