Re: log_statement and PREPARE - Mailing list pgsql-general

From Tom Lane
Subject Re: log_statement and PREPARE
Date
Msg-id 8211.1189127867@sss.pgh.pa.us
Whole thread Raw
In response to Re: log_statement and PREPARE  (brian <brian@zijn-digital.com>)
Responses Re: log_statement and PREPARE
List pgsql-general
brian <brian@zijn-digital.com> writes:
> But that should mean that my prepared statement that contains an INSERT
> should be logged, yes? (8.1 issues notwithstanding)
> I ask because i've set log_statement to 'mod' but am not seeing any
> of my prepared statements in the log. INSERT, UPDATE, and friends i
> do see.

Hm, works for me:

regression=# create temp table fooey(f1 int);
CREATE TABLE
regression=# prepare foo(int) as insert into fooey values($1);
PREPARE
regression=# execute foo(42);
INSERT 0 1
regression=# show log_statement;
 log_statement
---------------
 mod
(1 row)

in log:

LOG:  statement: create temp table fooey(f1 int);
LOG:  statement: prepare foo(int) as insert into fooey values($1);

The same sequence in 8.2 logs:

LOG:  statement: create temp table fooey(f1 int);
LOG:  statement: prepare foo(int) as insert into fooey values($1);
LOG:  statement: execute foo(42);
DETAIL:  prepare: prepare foo(int) as insert into fooey values($1);

If what you were looking for was that the *execute* gets logged
dependent on what the prepared statement was, then you need 8.2.
All that stuff got rewritten pretty heavily for 8.2 ...

            regards, tom lane

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Call for Speakers PostgreSQL Conference Fall 2007
Next
From: Michael Glaesemann
Date:
Subject: Re: Column as arrays.. more efficient than columns?