log_statement output for protocol prepare/bind/execute

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dave Cramer <pg(at)fastcrypt(dot)com>, Oliver Jowett <oliver(at)opencloud(dot)com>, Csaba Nagy <nagy(at)ecircle-ag(dot)com>, Postgres JDBC <pgsql-jdbc(at)postgresql(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: log_statement output for protocol prepare/bind/execute
Date: 2006-08-04 22:24:42
Message-ID: 200608042224.k74MOgA29758@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc pgsql-patches

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > ! (errmsg("statement: [protocol] <BIND> %s", portal_name)));
>
> > --- 1452,1460 ----
> > ! (errmsg("statement: <protocol> <BIND> %s [PREPARE: %s]",
> > ! *portal_name ? portal_name : "<unnamed>",
> > ! portal->sourceText ? portal->sourceText : "")));
>
> This is getting less readable not more so; and you still haven't got the
> prepared statement's name in there, let alone any place to put the
> parameter values.
>
> Perhaps we should give up on the idea that this can all fit on one log
> line? Maybe
>
> LOG: parse: <statement-name>
> DETAIL: statement: <source-text>
>
> LOG: bind: <portal-name> to <statement-name>
> DETAIL: statement: <source-text>
> parameter 1: <parameter value>
> parameter 2: <parameter value>
> ...
>
> LOG: execute: <portal-name>
> DETAIL: statement: <source-text>
>
> The $64 question here is whether we want to repeat the source-text
> in all three messages (parse, bind, execute) or try to reduce the
> verbosity.

I modified the code to store the user statement name in the portal for
protocol execute, so I can print the user name at that time. Here is
the new output:

LOG: statement protocol prepare sel1: SELECT 1;
LOG: statement protocol bind sel1: SELECT 1;
LOG: statement protocol execute sel1: SELECT 1;

Patch attached. I am also attaching my test program. Should I put that
in CVS somewhere? Libpq.sgml.

I had to pstrdup() the statement name. Is that OK?

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/pgpatches/prepare text/x-diff 7.0 KB
unknown_filename text/plain 2.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-04 22:37:14 Re: [PATCHES] log_statement output for protocol prepare/bind/execute
Previous Message Tom Lane 2006-08-04 21:54:35 Re: "Constraint exclusion" is not general enough

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2006-08-04 22:28:36 Re: log_statement output for protocol prepare/bind/execute
Previous Message Tom Lane 2006-08-04 21:43:38 Re: PGStatement#setPrepareThreshold

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-08-04 22:28:36 Re: log_statement output for protocol prepare/bind/execute
Previous Message Tom Lane 2006-08-04 21:43:38 Re: PGStatement#setPrepareThreshold