Re: Performance improvement proposal. Removal of toLowerCase calls.

Поиск
Список
Период
Сортировка
От Jeremy Whiting
Тема Re: Performance improvement proposal. Removal of toLowerCase calls.
Дата
Msg-id 52F27CEA.4010207@redhat.com
обсуждение исходный текст
Ответ на Re: Performance improvement proposal. Removal of toLowerCase calls.  (dmp <danap@ttc-cmc.net>)
Список pgsql-jdbc

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



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Jeremy Whiting
Дата:
Сообщение: Re: Performance improvement proposal. Removal of toLowerCase calls. PR
Следующее
От: zhangyuanchao
Дата:
Сообщение: One question about setting query timeout.