bit datatype and getObject()

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема bit datatype and getObject()
Дата
Msg-id ichd9g$e1g$1@dough.gmane.org
обсуждение исходный текст
Ответы Re: bit datatype and getObject()  (dmp <danap@ttc-cmc.net>)
Re: bit datatype and getObject()  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Hi,

the JDBC driver seems to map columns defined as "bit" to Boolean regardless of the definition of the column. So even a
bit(5)is returned as boolean value which I think is not correct. 

Consider the following

CREATE TABLE bit_test (some_bits bit(5));
INSERT INTO bit_test VALUES ('01010');

When I run a select in psql it will return 01010 as the column's value.

When running a select from within Java and using getObject() on that column a java.lang.Boolean is returned.

This might be correct for a bit(1) but not for columns defined with a bigger width.

It is returned correctly when using getString() on that column though.
But for applications using the generic getObject() this returns a wrong value.

I'm not sure what the JDBC specs requires here, but this mapping somehow is confusing.

I tested this with PG 9.0 and the JDBC4 build 801 driver.

Regards
Thomas



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Support for JDBC setQueryTimeout, et al.
Следующее
От: dmp
Дата:
Сообщение: Re: bit datatype and getObject()