Re: [GENERAL] capturing and storing query statement with

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Joe Conway <mail@joeconway.com>, Mike Mascari <mascarm@mascari.com>, Guillaume LELARGE <gleu@wanadoo.fr>, "Hackers (PostgreSQL)" <pgsql-hackers@postgresql.org>, Andrew Gould <andrewgould@yahoo.com>
Date: 2003-06-27T15:05:20Z
Lists: pgsql-hackers, pgsql-general
Peter Eisentraut <peter_e@gmx.net> writes:
> Joe Conway writes:
>> I was thinking something similar. This exact question has come up at
>> least three times in the last three months. I doubt we'd want a special
>> keyword like CURRENT_QUERY, but maybe current_query()?

> The current statement can be examined using the statistics views and
> functions.

That's not very reliable though --- unless the current query has been
running for quite a few milliseconds, there's no guarantee it will be
reflected in the statistics collector's output.

			regards, tom lane