Re: prepared statements don't log arguments?

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: prepared statements don't log arguments?
Date: 2005-04-07 02:27:32
Message-ID: 42549A94.3040209@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway wrote:
> Christopher Kings-Lynne wrote:
>
>> I think he has a really excellent point. It should log the parameters
>> as well.
>
>
> neilc=# prepare foo(int, int) as select $1 + $2;
> PREPARE
> neilc=# execute foo(5, 10);
> ...
> neilc=# execute foo(15, 20);
> ...
>
> % tail /usr/local/pgsql/postmaster.log
> LOG: statement: prepare foo(int, int) as select $1 + $2;
> LOG: statement: execute foo(5, 10);
> LOG: statement: execute foo(15, 20);

Query-level EXECUTE is logged, but Bind/Execute via the V3 extended
query protocol (which is what the JDBC driver does) isn't.

In fact, the logging for the extended query protocol really sucks: the
server logs only the Parse, and is silent about Bind/Execute, so there
are all sorts of strange cases where your statement logs do not reflect
what was actually executed at all. For example, the JDBC driver issues a
Parse (but no Execute!) when an application asks for type metadata from
a query, and it can issue multiple Bind/Executes for a single Parse.

I've raised this before on -hackers but haven't had time to do anything
about it myself yet.

-O

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2005-04-07 02:33:25 Re: prepared statements don't log arguments?
Previous Message Alvaro Herrera 2005-04-07 02:23:08 Re: prepared statements don't log arguments?