Re: Unable to prepare a statement when the object names contain more than one $ symbol - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Unable to prepare a statement when the object names contain more than one $ symbol
Date
Msg-id Pine.BSO.4.64.0707091229520.10973@leary.csoft.net
Whole thread Raw
In response to Unable to prepare a statement when the object names contain more than one $ symbol  (Altaf Malik <mmalik_altaf@yahoo.com>)
Responses Re: Unable to prepare a statement when the object names contain more than one $ symbol  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc

On Mon, 9 Jul 2007, Altaf Malik wrote:

> I have a table with two columns of type varchar and the table name
> contains two dollars. I am unable to prepare a statement for this table.
> Here is the code:
>
> PreparedStatement pstmt = con.prepareStatement("insert into a$b$c
> values( ? , ?)");

> Exception in thread "main" org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns:
0.

This is a bug in dollar quote parsing.  It assumes that any potential
dollar quote start will have an end tag.  When it doesn't find the end it
reports the end of the query, so the driver ends up skipping over the "?"
parameters.

Kris Jurka

pgsql-jdbc by date:

Previous
From: student23
Date:
Subject: stddev_pop, stddev_samp strange behaviour
Next
From: Tom Lane
Date:
Subject: Re: Unable to prepare a statement when the object names contain more than one $ symbol