Skip site navigation (1) Skip section navigation (2)

Best way to create DML/DDL log?

From: "Ingram, Bryan" <BIngram(at)sixtyfootspider(dot)com>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Best way to create DML/DDL log?
Date: 2000-08-21 15:37:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
I would like to create a long of all successful DML/DDL statements.

Has anyone accomplished this before?  No need to reinvent the wheel ...

If not ..I'm wondering what the best approach might be.

I have looked at the tcop/postgres.c source, thinking I might start by
modifying some of the -dX routines for generating debugging output. 

I've also tried working a little with the -E option to the postgres backend,
(passing it through postmaster as -o -E) but can't seem to redirect its

Finally, another option might be to create a trigger, but I haven't really
explored this option.

One of the main requirements is that any function which returns a value
which is determined by system environment must be written in the log as the
evaluated statement, and not written as the function itself.  e.g. now()
returns a text string of the current datetime which is written to the log in
place of the literal character string 'now()'

As far as modifying postgres.c, I'm fairly confident I can create a log of
the query buffer, but I haven't yet enough exposure to the source to find
where I should check to see whether or not a statement was successful, or
from where I might be able to pull text data from evaluated functions.

Any commentary on this would be much appreciated.  

Bryan Ingram

pgsql-sql by date

Next:From: Jan WieckDate: 2000-08-21 15:41:08
Subject: Re: 8K Limit, whats the best strategy?
Previous:From: Poul L. ChristiansenDate: 2000-08-21 15:20:24
Subject: Re: 8K Limit, whats the best strategy?

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group