Re: [GENERAL] event triggers in 9.3.4

2014-07-26 Thread Pavel Stehule
Hello 2014-07-25 20:46 GMT+02:00 Alvaro Herrera alvhe...@2ndquadrant.com: Pavel Stehule wrote: Hello I found a interesting extension http://code.malloclabs.com/pg_schema_triggers Ah, I remember that. I find that approach more cumbersome to use than mine. Note the ALTER cases can't

Re: [GENERAL] event triggers in 9.3.4

2014-07-25 Thread hubert depesz lubaczewski
On Thu, Jul 24, 2014 at 7:13 PM, Vasudevan, Ramya ramya.vasude...@classmates.com wrote: You could compare list of tables before (_start) and after (_end) the ddl. Doing it in plpgsql will be tricky, but if you'd use some other language - like plperl - it's relatively simple:

Re: [GENERAL] event triggers in 9.3.4

2014-07-25 Thread Vasudevan, Ramya
Sure - just check differences in appropriate catalogs. pg_attribute, pg_trigger, pg_proc. In any way - if you want to really use it - you'll have to write in C. Thank You Depesz. I think that answered my question. Thank You Ramya

Re: [GENERAL] event triggers in 9.3.4

2014-07-25 Thread Alvaro Herrera
Vasudevan, Ramya wrote: You could compare list of tables before (_start) and after (_end) the ddl. Doing it in plpgsql will be tricky, but if you'd use some other language - like plperl - it's relatively simple:

Re: [GENERAL] event triggers in 9.3.4

2014-07-25 Thread Pavel Stehule
Hello I found a interesting extension http://code.malloclabs.com/pg_schema_triggers Regards Pavel 2014-07-25 20:01 GMT+02:00 Alvaro Herrera alvhe...@2ndquadrant.com: Vasudevan, Ramya wrote: You could compare list of tables before (_start) and after (_end) the ddl. Doing it in plpgsql

Re: [GENERAL] event triggers in 9.3.4

2014-07-25 Thread Alvaro Herrera
Pavel Stehule wrote: Hello I found a interesting extension http://code.malloclabs.com/pg_schema_triggers Ah, I remember that. I find that approach more cumbersome to use than mine. Note the ALTER cases can't tell you much about exactly how the relation has changed; you have to run

Re: [GENERAL] event triggers in 9.3.4

2014-07-24 Thread hubert depesz lubaczewski
On Thu, Jul 24, 2014 at 2:22 AM, Vasudevan, Ramya ramya.vasude...@classmates.com wrote: CREATE TABLE log_ddl_info(ddl_tag text, ddl_event text, ddl_time timestamp); CREATE OR REPLACE FUNCTION log_ddl_execution() RETURNS event_trigger AS $$ DECLARE insertquery TEXT; BEGIN

Re: [GENERAL] event triggers in 9.3.4

2014-07-24 Thread Vasudevan, Ramya
You could compare list of tables before (_start) and after (_end) the ddl. Doing it in plpgsql will be tricky, but if you'd use some other language - like plperl - it's relatively simple: http://www.depesz.com/2013/12/18/waiting-for-9-4-plperl-add-event-trigger-support/ Thank You Depesz.

[GENERAL] event triggers in 9.3.4

2014-07-23 Thread Vasudevan, Ramya
I set up the following to log all DDLs executed in the database: CREATE TABLE log_ddl_info(ddl_tag text, ddl_event text, ddl_time timestamp); CREATE OR REPLACE FUNCTION log_ddl_execution() RETURNS event_trigger AS $$ DECLARE insertquery TEXT; BEGIN insertquery := 'INSERT INTO log_ddl_info

Re: [GENERAL] event triggers in 9.3.4

2014-07-23 Thread Adrian Klaver
On 07/23/2014 05:22 PM, Vasudevan, Ramya wrote: I set up the following to log all DDLs executed in the database: CREATE TABLE log_ddl_info(ddl_tag text, ddl_event text, ddl_time timestamp); CREATE OR REPLACE FUNCTION log_ddl_execution() RETURNS event_trigger AS $$ DECLARE insertquery TEXT;