Re: log_statement and PREPARE

From: brian <brian(at)zijn-digital(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: log_statement and PREPARE
Date: 2007-09-07 00:35:16
Message-ID: 46E09CC4.4020806@zijn-digital.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> brian <brian(at)zijn-digital(dot)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.
>

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.
>
> Ah. Probably you are confusing PREPARE-the-SQL-command, which is
> what this is speaking of, with the protocol-level prepared-statement
> functionality.

I'd thought i wasn't confusing the two. For instance, the MDB2 source
reveals the following in prepare():

$query = 'PREPARE '.$statement_name.$types_string.' AS '.$query;
$statement =& $this->_doQuery($query, true, $connection);

So, i do seem to be dealing, in the end, with PREPARE-the-SQL-command here.

> 8.1 is pretty bad about logging extended-query-protocol
> operations. If you can update to 8.2 you'll be happier.

I have been trying to find the time to move up to 8.2 lately. Perhaps
this evening is as good a time as any to do that on the dev box.

Thanks for your time.
brian

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ow Mun Heng 2007-09-07 00:37:29 Re: Column as arrays.. more efficient than columns?
Previous Message Tom Lane 2007-09-07 00:19:56 Re: log_statement and PREPARE