From: dmp <danap@ttc-cmc.net>
To: David Johnston <polobo@yahoo.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Case-sensitive problem in AS clause?
Date: Mon, 16 Jul 2012 12:31:23 -0600
Message-ID: <50045DFB.8010508@ttc-cmc.net> (raw)
In-Reply-To: <014801cd6372$e9d20850$bd7618f0$@yahoo.com>
References: <5004221A.4030508@antidot.net>
<50043BC9.2090401@ttc-cmc.net>
<014801cd6372$e9d20850$bd7618f0$@yahoo.com>
David Johnston wrote:
>> Pgjdbc, org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java is:
>>
>> /*
>> * Does a column's case matter? ASSUMPTION: Any field that is
>> * not obviously case insensitive is assumed to be case sensitive
>> *
> public boolean isCaseSensitive(int column) throws SQLException
> {
> Field field = getField(column);
> return connection.getTypeInfo().isCaseSensitive(field.getOID());
> }
> Does the "isCaseSensitive(int)" function return whether the "value" stored
> in the column is case-sensitive or does it return whether the "name" of the
> column is case-sensitive?
>
> The OP is using it to determine whether the "name" is case-sensitive - which
> it is always.
>
> My assumption is that it would indicate whether the "value" is
> case-sensitive - which is also true because varchar/text is case-sensitive.
>
> The fact that different fields may or may not be case-sensitive supports
> this since the "case-sensitive" property of a column "name" should be
> constant throughout the database/product.
>
> David J.
Case sensitivity appears to by based on the "type", not column "name" or
"value":
connection.getTypeInfo() returns TypeInfo
TypeInfo.isCaseSensitive() takes the field.getOID() which is a Type.
Test:
Connection Created
Select * from "Student"
Column: ID Type: 4 Type Name: int4 isSensitive: false
Column: Name Type: 12 Type Name: varchar is Sensitive: true
Connection Closed
Connection Created
Select ('Student' || "ID" ) AS StudentId from "Student"
Column: studentid Type: 12 Type Name: text isSensitive: true
Connection Closed
Your assumption appears be true, but based on type, which I guess you
could argue is value. The op is making the false assumption isCaseSenstive()
is based on column name which it is not looks from the code.
danap.
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: danap@ttc-cmc.net, polobo@yahoo.com
Subject: Re: Case-sensitive problem in AS clause?
In-Reply-To: <50045DFB.8010508@ttc-cmc.net>
References: <5004221A.4030508@antidot.net> <50043BC9.2090401@ttc-cmc.net> <014801cd6372$e9d20850$bd7618f0$@yahoo.com> <50045DFB.8010508@ttc-cmc.net>
* 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