Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-28 Thread Andreas Kretschmer
Susan Hurst wrote: > h...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

Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Susan Hurst
On 2015-12-27 13:19, Tom Lane wrote: Andreas Kretschmer 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

Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Andreas Kretschmer
> Melvin Davidson hat am 27. Dezember 2015 um 19:55 > geschrieben: > > > It's kind of difficult to figure out what is going on. Apparently, the > function that is called "store.add_history_master()" thinks tg_table_name > is a COLUMN in a table, as evidenced by > "ERROR:

Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Andreas Kretschmer
> 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 Really? http://www.postgresql.org/docs/9.5/static/plpgsql-trigger.html still contains only TG_EVENT and TG_TAG for Triggers on

[GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Susan Hurst
What is the correct syntax for calling a function from within an event trigger, passing in the table name and schema name as parameters to the function? The goal is to capture DDL changes to tables for the purpose of turning on (or off) auditing for production tables. The history_master

Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Adrian Klaver
On 12/27/2015 12:14 PM, Andreas Kretschmer wrote: 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 Really? http://www.postgresql.org/docs/9.5/static/plpgsql-trigger.html still

Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Tom Lane
Andreas Kretschmer 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

Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Melvin Davidson
It's kind of difficult to figure out what is going on. Apparently, the function that is called "store.add_history_master()" thinks tg_table_name is a COLUMN in a table, as evidenced by "ERROR: column "tg_table_name" does not exist" Offhand, you probably want to assign TG_TABLE_NAME to a var and