Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WB6oz-0004vt-1s for pgsql-jdbc@arkaria.postgresql.org; Wed, 05 Feb 2014 18:03:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WB6oy-0006wb-I4 for pgsql-jdbc@arkaria.postgresql.org; Wed, 05 Feb 2014 18:03:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WB6ox-0006wV-T8 for pgsql-jdbc@postgresql.org; Wed, 05 Feb 2014 18:03:35 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WB6ot-0006HK-3R for pgsql-jdbc@postgresql.org; Wed, 05 Feb 2014 18:03:35 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s15I3OjZ022900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Feb 2014 13:03:24 -0500 Received: from [10.36.116.42] (ovpn-116-42.ams2.redhat.com [10.36.116.42]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s15I3MB7029305; Wed, 5 Feb 2014 13:03:23 -0500 Message-ID: <52F27CEA.4010207@redhat.com> Date: Wed, 05 Feb 2014 18:03:22 +0000 From: Jeremy Whiting User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: dmp , Thomas Kellerer , PostgreSQL JDBC Subject: Re: Performance improvement proposal. Removal of toLowerCase calls. References: <52D7FE5E.3050503@redhat.com> <52D83125.2020908@ttc-cmc.net> <52D84217.6050003@ttc-cmc.net> In-Reply-To: <52D84217.6050003@ttc-cmc.net> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Pg-Spam-Score: -7.4 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org On 16/01/14 20:33, dmp wrote: > Thomas Kellerer wrote: >> Dave Cramer wrote on 16.01.2014 20:51: >>> >>> Are you sure ? This is in the resultset, so any column names should >>> have come back from the db. >>> Which means that they should come back in lower case anyway. >>> >>> create table foo >>> ( >>> "ID" integer, >>> "Bar" varchar >>> ); >>> >>> select * >>> from foo; >>> >>> Should return ID and Bar as the column names. >>> >>> >>> Exactly! While I haven't actually tested the code. The lines that >>> Jeremy is referring to would seem to suggest that >>> the return columns would be id and bar. >>> >>> Does anyone have time to test this ? >> >> The current driver returns this correctly for a ResultSet. >> >> Here is a "transcript" from running my application on the console >> (easier to copy & paste than a screenshot) >> >> SQL Workbench/J console interface started. >> Enter 'exit' to quit. >> Enter 'WbHelp' for a list of SQL Workbench/J specific commands >> Config directory: C:\Projects\sqlworkbench\conf >> >> SQL> wbconnect {Postgres}/WbTest; >> Connection to "User=thomas, Schema=public, >> URL=jdbc:postgresql://localhost/wbtest" successful >> >> thomas@wbtest/public> create table foo ("ID" integer, "Bar" varchar, >> "FoBaR" varchar); >> Table 'foo' created >> thomas@wbtest/public> insert into foo values (1, 'foo', 'bar'); >> INSERT executed successfully >> 1 row affected >> thomas@wbtest/public> select * from foo; >> ID | Bar | FoBaR >> ---+-----+------ >> 1 | foo | bar >> >> (1 Row) >> SELECT executed successfully >> thomas@wbtest/public> >> >> All the various API calls in DatabaseMetaData do return identifiers in >> the correct case as well. >> > > This is also the type of results that I have observed in the past in > testing. > The tableMetaData.getColumnName(i) will also return back the correct > mixed > case result. Ex. from table below. > > 1 Host > 2 Db > 3 Username > 4 select_priv > > Not only does this apply to columns but also to table names that are > quoted > Normally I use the following table to test such occurrences in my code. > > > DROP TABLE IF EXISTS "keY_tAble2"; > CREATE TABLE "keY_tAble2" ( > "Host" char(60) NOT NULL default '', > "Db" char(64) NOT NULL default '', > "Username" char(16) NOT NULL default '', > Select_priv boolean NOT NULL default TRUE, > PRIMARY KEY ("Host","Db","Username") > ); > > danap. > My testing does confirm the findings by danap and Thomas too. Names are correctly returned mixed. My proposal is for situations where the known case is already all upper or lower. For situations other than that the feature can be ignored. The current driver behaviour will be the default to prevent applications breaking. I don't have as much oversight on all possible use cases as others in the community. I may have been overlooked something. What other concerns are there if any ? Jeremy -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc