Обсуждение: Uppercase problem in jdbc2 DatabaseMetaData.getColumns()

Поиск
Список
Период
Сортировка

Uppercase problem in jdbc2 DatabaseMetaData.getColumns()

От
Patrice Le Gurun
Дата:
Hello everybody !

I currently work on a project based on Java and PostgreSQL. This morning I
"discovered" a bug in DatabaseMetaData.getColumns() that did not retrieve
columns's informations when the table's name containt some uppercase
characters. It's a big problem for me because I must work with some tables
with uppercase char.

After some looks on the CVS tree, it seems that the tablename pattern is
converted to lowercase in the request. Is it possible to not convert the
pattern to lowercase or use a insensitive case search ?

--
Patrice Le Gurun
mailto:patrice.le-gurun@wanadoo.fr
"GNU/Linux lets you drink more beer !"

Re: Uppercase problem in jdbc2 DatabaseMetaData.getColumns()

От
Pete Jewell
Дата:
Patrice Le Gurun <patrice.le-gurun@wanadoo.fr> writes:

> Hello everybody !
>
> I currently work on a project based on Java and PostgreSQL. This morning I
> "discovered" a bug in DatabaseMetaData.getColumns() that did not retrieve
> columns's informations when the table's name containt some uppercase
> characters. It's a big problem for me because I must work with some tables
> with uppercase char.
>
> After some looks on the CVS tree, it seems that the tablename pattern is
> converted to lowercase in the request. Is it possible to not convert the
> pattern to lowercase or use a insensitive case search ?

That's odd - I thought pgsql was case insensitive when it came to
table and column names?  Ie,

SELECT ID FROM TESTDB;

and

select id from testdb;

are functionally equivalent?

BTW - great piece of s/w guys!  We're using it as one of the db
drivers in the MaVerick project (DataBasic compiler) - can't wait for
update-able resultsets & rs.getArray(1) :-)

--
Pete

pete@maverick-dbms.org
-------------------------------------------------------------
MaVerick - Open Source MultiValue Database Management System
Check out the website     ->    http://www.maverick-dbms.org

Re: Uppercase problem in jdbc2 DatabaseMetaData.getColumns()

От
Patrice Le Gurun
Дата:
Pete Jewell <pete@example.compulink.co.uk> writes:

> That's odd - I thought pgsql was case insensitive when it came to
> table and column names?  Ie,
>
> SELECT ID FROM TESTDB;
>
> and
>
> select id from testdb;
>
> are functionally equivalent?

Not really with the JDBC driver. You have to put column and table names into
double quotes if you have those names with uppercase. Ie, with a table TestDB
with a column named IdTest, you must sent the request :
    SELECT * FROM "TestDb" WHERE "IdTest" = 3
to Statement.execute() if you want to read the row. If you forget the quotes,
you'll have an SQLException which said something like "Table testdb does not
exist."

--
Patrice Le Gurun
mailto:patrice.le-gurun@wanadoo.fr
"GNU/Linux lets you drink more beer !"