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