Re: BUG #3751: Conversion error using PreparedStatement.setObject()

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: BUG #3751: Conversion error using PreparedStatement.setObject()
Дата
Msg-id 473CEC15.1070205@ejurka.com
обсуждение исходный текст
Ответ на BUG #3751: Conversion error using PreparedStatement.setObject()  ("Lance Andersen" <lance.andersen@sun.com>)
Ответы Re: BUG #3751: Conversion error using PreparedStatement.setObject()  ("Lance J. Andersen" <Lance.Andersen@Sun.COM>)
Список pgsql-bugs
Lance J. Andersen wrote:
> Thank you for your time, but i think there is still a driver issue here:
>
>
> If i use the same  types as i sent in the email and execute
>
> select * from  bit_in_min(1::bit)
>
> I have no problems and the table is correctly updated.
>
> This would lead me to believe that the driver has a problem with
> correctly mapping the setObect() of the String to a BIT which is
> required conversion by the JDBC spec.
>

According to our reading of the JDBC spec java.sql.Types.BIT and BOOLEAN
are equivalent.  So it doesn't make sense to map BIT to one server type
and BOOLEAN to another.  When thinking about Types.BIT it's easy to see
a server type named "bit" and assume it's a match, but for the semantics
of Types.BIT, we think boolean is a better match.

http://archives.postgresql.org/pgsql-jdbc/2004-04/msg00107.php

Just because "bit" can be made to work doesn't make it the best option.
  Particularly our concern arises from what to do when returning meta
data.  Consider a table that has columns "a bit(1), b bit(2)".  While a
does have boolean semantics because it's limited to a length of 1, b is
not.  Returning b as Types.BIT would be a mistake.  Driving this
decision solely on the length attribute is not good because the server
will not give you the length information in certain circumstances and
all you'll have is the raw "bit" type name.  This is why we've chose to
use boolean as the server type for Types.BIT + BOOLEAN.

Kris Jurka

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: BUG #3751: Conversion error using PreparedStatement.setObject()
Следующее
От: Koichi Suzuki
Дата:
Сообщение: B-tree crash recovery error in 8.3 beta 2