logging statements from hibernate to valid SQL

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: logging statements from hibernate to valid SQL
Date: 2010-02-09 10:00:31
Message-ID: 1dd6057e1002090200i742a26eau4c01f2743ad320ed@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I'm trying to log statements that are being fired from hibernate, so that i
can benchmark them without hibernate itself.
I want to fire the SQL at the database directly and see what difference i
can make by tweaking things.

But when i set log_statement = 'all', the logging looks like this:

2010-02-09 00:12:32 CET LOG: execute <unnamed>: select nextval
('schema.sequence')
2010-02-09 00:12:32 CET LOG: execute <unnamed>: insert into schema.tabe
(field1, field2, field3, ...) values ($1, $2, $3, ...)
2010-02-09 00:12:32 CET DETAIL: parameters: $1 = '1', $2 = NULL, $3 =
'654767', ...)

Now, how can i get these $1 etc values to be replaced with their values, so
that i can produce valid SQL?
Is there a postgresql.conf setting, or maybe some perl script that goes
around?
(of course, it's more than just 3 lines.... I can't do it by hand.)

thx!

WBL

--
"Patriotism is the conviction that your country is superior to all others
because you were born in it." -- George Bernard Shaw

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2010-02-09 10:09:24 Re: viewing large queries in pg_stat_activity
Previous Message AI Rumman 2010-02-09 09:51:51 string reverse fucntion?