Re: log_statement and PREPARE - Mailing list pgsql-general

From Tom Lane
Subject Re: log_statement and PREPARE
Date
Msg-id 6552.1189124396@sss.pgh.pa.us
Whole thread Raw
In response to log_statement and PREPARE  (brian <brian@zijn-digital.com>)
Responses Re: log_statement and PREPARE
List pgsql-general
brian <brian@zijn-digital.com> writes:
> The docs (8.1) say the following about log_statement:
> -- snip --
> ... mod logs all ddl statements, plus INSERT, UPDATE, DELETE, TRUNCATE,
> and COPY FROM. PREPARE and EXPLAIN ANALYZE statements are also logged if
> their contained command is of an appropriate type.
> -- snip --

> Can someone please expain the meaning of, "if their contained command is
> of an appropriate type"? I take it to mean that the prepared statement
> will be logged if the it contains an INSERT (if 'mod' was chosen, of
> course).

I think you mis-parsed it.  The sentence about PREPARE et al is an
independent sentence applying to all the possible values of
log_statement.  That is, these commands will be logged if the contained
command is one that would have been logged, at the current log level.

> 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.

Ah.  Probably you are confusing PREPARE-the-SQL-command, which is what
this is speaking of, with the protocol-level prepared-statement
functionality.  8.1 is pretty bad about logging extended-query-protocol
operations.  If you can update to 8.2 you'll be happier.

            regards, tom lane

pgsql-general by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Do AGGREGATES consistently use sort order?
Next
From: brian
Date:
Subject: Re: log_statement and PREPARE