Skip site navigation (1) Skip section navigation (2)

Re: Case-sensitive problem in AS clause?

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: dmp <danap(at)ttc-cmc(dot)net>
Cc: David Johnston <polobo(at)yahoo(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Case-sensitive problem in AS clause?
Date: 2012-07-16 18:48:22
Message-ID: CADK3HH+aHznmFJ5nVHm9SYVvzcDE8vZ-g2pCSCYgj7hyn_bPAw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Ok, I just looked up the tutorial and it really is whether the value
stored in the column is case sensitive, not the name of the column.

Yet another serious ambiguity in the API spec.

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Mon, Jul 16, 2012 at 2:31 PM, dmp <danap(at)ttc-cmc(dot)net> wrote:
> 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.
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc

In response to

Responses

pgsql-jdbc by date

Next:From: Craig RingerDate: 2012-07-17 03:16:02
Subject: Re: not fetching all query results
Previous:From: dmpDate: 2012-07-16 18:31:23
Subject: Re: Case-sensitive problem in AS clause?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group