pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ingram, Bryan <BIngram@sixtyfootspider.com>
To: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Best way to create DML/DDL log?
Date: Mon, 21 Aug 2000 10:37:13 -0500
Message-ID: <01CCE949D2717845BA2E573DC081167E052E84@BKMAIL.sixtyfootspider.com> (raw)

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
output.

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.  

Thanks,
Bryan Ingram







view thread (3+ messages)  latest in thread

Message-ID: <01CCE949D2717845BA2E573DC081167E052E84@BKMAIL.sixtyfootspider.com>
Permalink:  ../01CCE949D2717845BA2E573DC081167E052E84@BKMAIL.sixtyfootspider.com/
Also on:    postgresql.org/message-id/01CCE949D2717845BA2E573DC081167E052E84@BKMAIL.sixtyfootspider.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: BIngram@sixtyfootspider.com
  Subject: Re: Best way to create DML/DDL log?
  In-Reply-To: <01CCE949D2717845BA2E573DC081167E052E84@BKMAIL.sixtyfootspider.com>
  References: <01CCE949D2717845BA2E573DC081167E052E84@BKMAIL.sixtyfootspider.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox