Hi to all,
I realy need help of you. My problem is $subj. I mean, for example. If user run command like:
INSERT INTO public.foo (at1,at10) VALUES ('val1','val10')
I would need to catch this (may be in trigger?) and store this textual command to other log table. Later I will need to run EXECUTE on this. That's why logging.
I tryied to build a trigger, but it's not generally usable, becase some user may run INSERT stmt with others specified atributes (some of them have default values) and trigger cannot catch this situation.
Or anyone has other possible solution how to solve this problem? Generaly: on specified tables I need to know (inside PostgreSQL, not seeing log files in system) which command user run. This is because of I need to made of very simplified asynchronnous multimaster replication (better say synchronization).
Thank's to all contributions...
I create something like this:
CREATE OR REPLACE FUNCTION ftgr_data_all() RETURNS trigger AS $$
IF (TG_OP = 'INSERT') THEN
INSERT INTO rep.repl_log (id,op,cmd)
'INSERT INTO '||fname||' '||
ELSEIF (TG_OP = 'UPDATE') THEN
ELSEIF (TG_OP = 'DELETE') THEN
$$ LANGUAGE plpgsql;
pgsql-novice by date
|Next:||From: A. Kretschmer||Date: 2007-04-24 09:35:27|
|Subject: Re: How to log whole query statement to relation?|
|Previous:||From: Jasbinder Singh Bali||Date: 2007-04-21 23:53:15|
|Subject: Re: call pl/pgsql stored functions from ecpg?|