Re: statement logging / extended query protocol issues

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: statement logging / extended query protocol issues
Date: 2005-09-16 21:13:40
Message-ID: 432B3584.6050103@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:

> Well, from the application writer perspective, you are right it doesn't
> make sense,

This is exactly what the end user is going to say.

> but this is only because jdbc is using prepare internally.

Isn't this mostly irrelevant to the result we want to see? It's a detail
of how the interface layer chooses to execute its queries, and 90% of
the time the end user is not going to know or care about it.

> If you were to have written it in libpq, it would make sense, I think,
> and internally, this is what is happening. We can't assume only
> interface libraries like jdbc are using this feature.

Wait, so is the extended query protocol the poor cousin of "what libpq
does", or what? You can do Parse/Bind using libpq, can't you?

The *meaning* of the Parse/Bind/Execute sequence is quite clear
regardless of what interface library is used. I still think that logging
just the queries that were actually executed, once per execution, is the
sensible thing to do here. I can't see a sequence of protocol messages
that would produce a strange result if we used the rules I suggested --
do you have an example where it breaks?

> As far as I understand things, the protocol-level prepare/execute is
> identical to the SQL-level prepare/execute, except that there is no need
> to parse the execute, so it should log like the SQL-level statements, if
> possible.

You can Parse any SQL statement, but you can't PREPARE any SQL
statement. So, no, they're not equivalent. That's one aspect of what I
meant about generating synthetic statements that weren't syntactially
correct (the strange FETCH syntax with ROWS/MAXROWS that Simon was
suggesting is another case).

-O

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonah H. Harris 2005-09-16 21:30:02 Re: Why does VACUUM FULL bother locking pages?
Previous Message Alvaro Herrera 2005-09-16 21:07:34 Re: Why does VACUUM FULL bother locking pages?

Browse pgsql-patches by date

  From Date Subject
Next Message a_ogawa 2005-09-18 01:46:52 doc/FAQ_DEV: about profile
Previous Message Bruce Momjian 2005-09-16 19:52:37 Re: [PATCHES] Caveat for Domains