Tue Jan 12 08:21:57 PST 2016
- Previous message: [Slony1-general] Slony-I: log switch to sl_log_2 still in progress - sl_log_1 not truncated
- Next message: [Slony1-general] log insert/update query executed on subscriber
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello, Is it possible to log query with parameters executed on subscriber node? I've tried to add __audit trigger before insert or update, but when denyaccess trigger is enabled, nothing is logged. Below is my try for table emp: CREATE SCHEMA audit; CREATE TABLE audit.slon_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, userid text NOT NULL, query text NOT NULL ); CREATE OR REPLACE FUNCTION save_query() RETURNS TRIGGER AS $$ BEGIN IF (TG_OP = 'DELETE') THEN INSERT INTO audit.slon_audit SELECT 'D', now(), user, OLD.*; RETURN OLD; ELSIF (TG_OP = 'UPDATE') THEN INSERT INTO audit.slon_audit SELECT 'U', now(), user, current_query(); RETURN NEW; ELSIF (TG_OP = 'INSERT') THEN INSERT INTO audit.slon_audit SELECT 'I', now(), user, current_query(); RETURN NEW; END IF; RETURN NULL; END; $$ LANGUAGE plpgsql; CREATE TRIGGER __audit BEFORE INSERT OR UPDATE OR DELETE ON emp FOR EACH ROW EXECUTE PROCEDURE save_query(); -- Pozdrawiam, Krzysztof Jakowczyk Administrator Systemów Unix Grupa Unity | ul. Przedmiejska 6-10, 54-201 Wrocław ul. Conrada 55B, 31-357 Kraków | ul. Złota 59, 00-120 Warszawa
- Previous message: [Slony1-general] Slony-I: log switch to sl_log_2 still in progress - sl_log_1 not truncated
- Next message: [Slony1-general] log insert/update query executed on subscriber
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list