Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 39F3955C5A5 for ; Mon, 16 Jul 2012 15:38:13 -0300 (ADT) Received: from outbound.vnet-inc.com ([216.146.104.103]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SqqBO-0004O3-VN for pgsql-jdbc@postgresql.org; Mon, 16 Jul 2012 18:38:13 +0000 Received: from [192.168.157.132] (unknown [76.75.27.41]) by outbound.vnet-inc.com (Postfix) with ESMTP id 549BC59D5; Mon, 16 Jul 2012 12:37:58 -0600 (MDT) Message-ID: <50045DFB.8010508@ttc-cmc.net> Date: Mon, 16 Jul 2012 12:31:23 -0600 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.13) Gecko/20100914 SeaMonkey/2.0.8 MIME-Version: 1.0 To: David Johnston , pgsql-jdbc@postgresql.org Subject: Re: Case-sensitive problem in AS clause? References: <5004221A.4030508@antidot.net> <50043BC9.2090401@ttc-cmc.net> <014801cd6372$e9d20850$bd7618f0$@yahoo.com> In-Reply-To: <014801cd6372$e9d20850$bd7618f0$@yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/20 X-Sequence-Number: 23118 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.