Re: How to log whole query statement to relation?

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to log whole query statement to relation?
Date: 2007-04-24 09:35:27
Message-ID: 20070424093527.GI11053@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

am Tue, dem 24.04.2007, um 9:00:54 +0200 mailte David Flegl folgendes:
> 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).

I think, you can't do log the sql as text, but you can tools like
'tablelog' to obtain a similar behavior:

http://ads.wars-nicht.de/blog/archives/100-Log-Table-Changes-in-PostgreSQL-with-tablelog.html

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David Flegl 2007-04-24 11:13:50 Re: How to log whole query statement to relation?
Previous Message David Flegl 2007-04-24 07:00:54 How to log whole query statement to relation?