Re: Error while returning auto-generated values - Mailing list pgsql-jdbc

From Craig Ringer
Subject Re: Error while returning auto-generated values
Date
Msg-id 509B698B.1040903@2ndQuadrant.com
Whole thread Raw
In response to Error while returning auto-generated values  (Amila De Silva <amilad@wso2.com>)
Responses Re: Error while returning auto-generated values  (Amila De Silva <amilad@wso2.com>)
List pgsql-jdbc
On 11/08/2012 04:00 PM, Amila De Silva wrote:
>
> Simply by changing the case of SUBSCRIBER_ID to lower case, in return
> column array ,this error can be avoided. But the problem is that
> change is not feasible.

Yes, that's how it works. It's nothing to do with JDBC, you'll get the
same result if you run the query directly in psql.

"DOUBLE QUOTED" identifiers are case-preserving, while unquoted
identifiers are downcased. This means that you must quote consistently -
everywhere, or nowhere.

PgJDBC does not have a parameter to control this behaviour because
PostgreSQL does not have a parameter to control it. PgJDBC can hardly
parse all your SQL and add or remove quoting - in fact, attempting to do
so could be very dangerous and even lead to security vulnerabilities.

> Is it possible to solve this problem by changing the DDL statement or
> any connection parameters?
Yes, you need to change the DDL so that it also "DOUBLE QUOTES"
identifiers if they are "DOUBLE QUOTED" when used in queries.

If your queries use a mix of unquoted and quoted values, or mix of
cases, then you're going to have go to through and fix them all to be
consistent.

--
Craig Ringer



pgsql-jdbc by date:

Previous
From: Amila De Silva
Date:
Subject: Error while returning auto-generated values
Next
From: Dave Cramer
Date:
Subject: Re: Possible bug / regression from generated keys