pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@2ndQuadrant.com>
To: Amila De Silva <amilad@wso2.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Error while returning auto-generated values
Date: Thu, 08 Nov 2012 16:12:59 +0800
Message-ID: <509B698B.1040903@2ndQuadrant.com> (raw)
In-Reply-To: <CAJcWjJHmimJDfirCsLaYrkxtO0FCxNAE25AW+4-LR7fOrA8u4Q@mail.gmail.com>
References: <CAJcWjJHmimJDfirCsLaYrkxtO0FCxNAE25AW+4-LR7fOrA8u4Q@mail.gmail.com>

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





view thread (4+ messages)  latest in thread

Message-ID: <509B698B.1040903@2ndQuadrant.com>
Permalink:  ../509B698B.1040903@2ndQuadrant.com/
Also on:    postgresql.org/message-id/509B698B.1040903@2ndQuadrant.com

 · 

reply

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: craig@2ndQuadrant.com, amilad@wso2.com
  Subject: Re: Error while returning auto-generated values
  In-Reply-To: <509B698B.1040903@2ndQuadrant.com>
  References: <CAJcWjJHmimJDfirCsLaYrkxtO0FCxNAE25AW+4-LR7fOrA8u4Q@mail.gmail.com> <509B698B.1040903@2ndQuadrant.com>

* 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