Re: Under what circumstances does PreparedStatement use stored plans?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Robinson <jlrobins(at)socialserve(dot)com>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Under what circumstances does PreparedStatement use stored plans?
Date: 2004-04-14 03:04:50
Message-ID: 29504.1081911890@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

James Robinson <jlrobins(at)socialserve(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message James Robinson 2004-04-14 03:26:18 Re: Under what circumstances does PreparedStatement use stored plans?
Previous Message James Robinson 2004-04-14 02:39:12 Re: Statement pooling implementation (was Re: Under what circumstances does PreparedStatement use stored plans?)