Received: from web805.mail.yahoo.com (web805.mail.yahoo.com [128.11.23.65]) by hub.org (8.10.1/8.10.1) with SMTP id e7LGKbT16756 for ; Mon, 21 Aug 2000 12:20:38 -0400 (EDT) Received: (qmail 29663 invoked by uid 60001); 21 Aug 2000 16:20:36 -0000 Message-ID: <20000821162036.29662.qmail@web805.mail.yahoo.com> Received: from [169.2.229.71] by web805.mail.yahoo.com; Mon, 21 Aug 2000 09:20:36 PDT Date: Mon, 21 Aug 2000 09:20:36 -0700 (PDT) From: Webb Sprague Subject: Re: Best way to create DML/DDL log? To: "Ingram, Bryan" , "'pgsql-sql@postgresql.org'" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200008/204 I think there is either a switch to the psql client or a "\" command in the session that allows you to log to a file. Even if you have to do some redirection, it seems a lot better than modifying postgres.c (though I am quite impressed that you would think about it...) --- "Ingram, Bryan" wrote: > 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 > > > > __________________________________________________ Do You Yahoo!? Yahoo! Mail – Free email you can access from anywhere! http://mail.yahoo.com/