From: Marc Herbert <Marc.Herbert@continuent.com>
To: pgsql-jdbc@postgresql.org
Subject: cannot dollar-quote $$?$$ in PreparedStatements
Date: Wed, 11 Jan 2006 12:41:50 +0100
Message-ID: <khjoe2jt2ip.fsf@meije.emic.fr> (raw)
With 8.0 postgresql and driver, this works fine:
ps = con.prepareStatement("insert into product values(?, '?' , ?)");
But this fails:
ps = con.prepareStatement("insert into product values(?, $$?$$ , ?)");
It looks like "someone" (driver or engine?) is counting 3 parameters instead of 3:
org.postgresql.util.PSQLException: Pas de valeur specifiee pour le parametre 3.
at org.postgresql.core.v3.SimpleParameterList.checkAllParametersSet(SimpleParameterList.java:102)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:166)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
at TestFetchSize.main(TestFetchSize.java:86)
How dollar-quoting and question marks are supposed to interact?
Sorry if this a well-known issue.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: Marc.Herbert@continuent.com
Subject: Re: cannot dollar-quote $$?$$ in PreparedStatements
In-Reply-To: <khjoe2jt2ip.fsf@meije.emic.fr>
References: <khjoe2jt2ip.fsf@meije.emic.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox