From: Kris Jurka <books@ejurka.com>
To: Marc Herbert <Marc.Herbert@continuent.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: cannot dollar-quote $$?$$ in PreparedStatements
Date: Wed, 11 Jan 2006 11:58:55 -0500 (EST)
Message-ID: <Pine.BSO.4.61.0601111155320.13150@leary.csoft.net> (raw)
In-Reply-To: <khjoe2jt2ip.fsf@meije.emic.fr>
References: <khjoe2jt2ip.fsf@meije.emic.fr>
On Wed, 11 Jan 2006, Marc Herbert wrote:
>
> 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:
>
This is a known issue. The driver has no knowledge of dollar quotes in
its query parser. This is not just a problem for parameters, but also an
issue when people want to issue a create function command with
Statement.execute("CREATE FUNCTION f() RETURNS int AS $$ [a number of
statements separated by semicolons] $$ language plpgsql"); The driver
will detect the semicolons and try to execute each fragment separately.
So this is a know issue with the only workaround being to not use dollar
quotes.
Kris Jurka
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: books@ejurka.com, Marc.Herbert@continuent.com
Subject: Re: cannot dollar-quote $$?$$ in PreparedStatements
In-Reply-To: <Pine.BSO.4.61.0601111155320.13150@leary.csoft.net>
References: <khjoe2jt2ip.fsf@meije.emic.fr> <Pine.BSO.4.61.0601111155320.13150@leary.csoft.net>
* 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