Re: Prepared Statements vs. pgbouncer - Mailing list pgsql-jdbc

From Paul Lindner
Subject Re: Prepared Statements vs. pgbouncer
Date
Msg-id 20071001215511.GS3140@inuus.com
Whole thread Raw
In response to Re: Prepared Statements vs. pgbouncer  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
On Tue, Oct 02, 2007 at 10:19:56AM +1300, Oliver Jowett wrote:
> Oliver Jowett wrote:
> >Paul Lindner wrote:
> >
> >>Why doesn't the Postgres JDBC driver use cursors for ResultSets
> >>instead of creating prepared statements?  Is this not supported in the
> >>v3 protocol?  (I'd answer this question myself, but no time to read
> >>code at the moment...)
> >
> >It uses portals which are the v3 equivalent of cursors.
>
> To elaborate a bit more: you need a statement before you can create a
> portal, and the unnamed statement is no use for this particular case as
> we need the portal to live despite reuse of the unnamed statement, and
> the implicit close of the unnamed statement on reuse also causes any
> dependant portal to close. So we must use a named statement so that we
> can control the lifetime of the portal correctly.

Okay, Okay, I have read much of

  http://www.postgresql.org/docs/current/static/protocol.html

and much of

  src/backend/tcop/postgres.c

and much of

  src/backend/commands/portalcmds.c

I'm a newbie here, but it appears that PerformCursorOpen() is callable
from the SQL grammar, not directly via the protocol.

My apologies for mixing up PL/PGSQL and V3 protocol.


--
Paul Lindner        ||||| | | | |  |  |  |   |   |
lindner@inuus.com

Attachment

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Prepared Statements vs. pgbouncer
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: Prepared Statements vs. pgbouncer