Re: cannot dollar-quote $$?$$ in PreparedStatements - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: cannot dollar-quote $$?$$ in PreparedStatements
Date
Msg-id Pine.BSO.4.61.0601111155320.13150@leary.csoft.net
Whole thread Raw
In response to cannot dollar-quote $$?$$ in PreparedStatements  (Marc Herbert <Marc.Herbert@continuent.com>)
List pgsql-jdbc

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


pgsql-jdbc by date:

Previous
From: Roland Walter
Date:
Subject: Re: Memory leak or client side caching?
Next
From: Takeichi Kanzaki Cabrera
Date:
Subject: reading an oidvector field error