Re: Under what circumstances does PreparedStatement use stored plans? - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: Under what circumstances does PreparedStatement use stored plans?
Date
Msg-id 29504.1081911890@sss.pgh.pa.us
Whole thread Raw
In response to Re: Under what circumstances does PreparedStatement use stored plans?  (James Robinson <jlrobins@socialserve.com>)
Responses Re: Under what circumstances does PreparedStatement use stored plans?
List pgsql-jdbc
James Robinson <jlrobins@socialserve.com> writes:
> Diving in, I see that Postgres's PREPARE statement needs the types
> up-front, as in:
>     PREPARE t_prep (TEXT) as select id from users where name = $1;

Yes, but that is not the facility you want to use.  The facility that
was specifically designed to support JDBC is the V3-protocol prepare/
bind/execute message group.  That stuff can push back inferred parameter
types, which is what I think you are looking for.  See
http://www.postgresql.org/docs/7.4/static/protocol.html
particularly
http://www.postgresql.org/docs/7.4/static/protocol-flow.html#AEN52666
There's also a bunch of discussion in the mail list archives from about
a year ago.

            regards, tom lane

pgsql-jdbc by date:

Previous
From: James Robinson
Date:
Subject: Re: Statement pooling implementation (was Re: Under what circumstances does PreparedStatement use stored plans?)
Next
From: James Robinson
Date:
Subject: Re: Under what circumstances does PreparedStatement use stored plans?