Re: Unable to prepare a statement when the object names contain more than one $ symbol

From: Kris Jurka <books(at)ejurka(dot)com>
To: Altaf Malik <mmalik_altaf(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, mpaesold(at)gmx(dot)at
Subject: Re: Unable to prepare a statement when the object names contain more than one $ symbol
Date: 2007-07-09 16:31:41
Message-ID: Pine.BSO.4.64.0707091229520.10973@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2007-07-09 16:45:58 Re: Unable to prepare a statement when the object names contain more than one $ symbol
Previous Message student23 2007-07-09 12:29:41 stddev_pop, stddev_samp strange behaviour