Re: change format of logging statements?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Matthew Hixson <hixson(at)poindextrose(dot)org>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: change format of logging statements?
Date: 2007-10-26 20:07:54
Message-ID: 20071026200754.GB6725@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Matthew Hixson <hixson(at)poindextrose(dot)org> writes:
> > Instead of:
> > DEBUG: insert into foo (name) values ($1);
> > DETAIL: parameters: $1 = 'stan'
> > I'd like to see:
> > DEBUG: insert into foo (name) values ('stan');
>
> Don't hold your breath. That would require a great deal more smarts
> in the logging code (and a great deal more cycles expended) than it
> has now.

That said, you can use explain on these things, though you must do a bit
more work:

alvherre=# prepare foo as insert into foo (name) values ($1);
PREPARE
alvherre=# explain execute foo('stan');
QUERY PLAN
------------------------------------------
Result (cost=0.00..0.01 rows=1 width=0)
(1 ligne)

The benefit is that this will use the same plan that Hibernate would be
using, whereas simply expanding the literal in the query would possibly not.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chuck D. 2007-10-26 20:17:07 Re: Geographic data sources, queries and questions
Previous Message Rainer Bauer 2007-10-26 19:35:05 Re: 8.2.3: Server crashes on Windows using Eclipse/Junit