Re: [HACKERS] [PATCHES] log_statement output for protocol

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Oliver Jowett <oliver(at)opencloud(dot)com>, Dave Cramer <pg(at)fastcrypt(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: Re: [HACKERS] [PATCHES] log_statement output for protocol
Date: 2006-08-31 18:48:19
Message-ID: 200608311848.k7VImJt20927@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc pgsql-patches

Guillaume Smet wrote:
> On 8/30/06, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > I thought about this, and because we are placing two pieces of
> > information on the same line, it seems "|" is the best choice.
>
> Good idea. It's far more readable with a pipe.
>
> > Oh. You want to pull the parameters out of that. I am thinking you
> > need something that will go over the line character by character with
> > some type of state machine, rather than just regex.
>
> Yes, that's what I did but I usually prefer a regex.
>
> > Additional comments?
>
> I confirm it now works with NULL. I'm just wondering if the notation
> is really consistent:
> $result = pg_execute($dbconn, "insert_query", array(null));
> gives:
> DETAIL: prepare: INSERT INTO shop (name) VALUES($1) | bind: $1 = NULL
> However:
> $result = pg_execute($dbconn, "insert_query", array(4));
> gives:
> DETAIL: prepare: INSERT INTO shop (name) VALUES($1) | bind: $1 = '4'
>
> But I don't think it's possible to have 4 in this case. Can you confirm?

All supplied parameters have single quotes around them. Only NULL doesn't.

> I have all the different cases parsed correctly by my parser and I can
> build the query from the logs so it's OK for me. In the above case,
> with an int, I remove the quotes if the content is numeric. It's not
> perfect but I suppose it will be OK most of the time.

Well, the parameter is supplied as text, so I always quote it in the
logs.

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

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2006-08-31 18:51:54 Re: Thought provoking piece on NetBSD
Previous Message Tom Lane 2006-08-31 18:45:49 Re: BUG #2600: dblink compile with SSL missing libraries

Browse pgsql-jdbc by date

  From Date Subject
Next Message Trygve Hardersen 2006-09-01 13:40:06 Strange JDBC problem
Previous Message Guillaume Smet 2006-08-31 17:33:14 Re: [HACKERS] [PATCHES] log_statement output for protocol

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-08-31 18:57:41 Re: [HACKERS] Interval aggregate regression failure
Previous Message Tom Lane 2006-08-31 18:45:49 Re: BUG #2600: dblink compile with SSL missing libraries