Re: JDBC String to Bool spec

Поиск
Список
Период
Сортировка
Искать
От
Mark Rotteveel
Тема
Re: JDBC String to Bool spec
Дата
Msg-id
7c2e158ed4db19a6bb66ad369e6fd233@lawinegevaar.nl
Ответ на
Список
Дерево обсуждения
[JDBC] JDBC String to Bool spec Kevin Wooten <kdubb@me.com>
Re: JDBC String to Bool spec Mark Rotteveel <mark@lawinegevaar.nl>
Re: [JDBC] JDBC String to Bool spec Thomas Kellerer <spam_eater@gmx.net>
Re: JDBC String to Bool spec Mark Rotteveel <mark@lawinegevaar.nl>
Re: JDBC String to Bool spec Mark Rotteveel <mark@lawinegevaar.nl>
Re: [JDBC] JDBC String to Bool spec Dave Cramer <pg@fastcrypt.com>
Re: [JDBC] JDBC String to Bool spec Kevin Wooten <kdubb@me.com>
Re: [JDBC] JDBC String to Bool spec Kevin Wooten <kdubb@me.com>
Re: JDBC String to Bool spec Dave Cramer <pg@fastcrypt.com>
Re: [JDBC] JDBC String to Bool spec Kevin Wooten <kdubb@me.com>
Re: JDBC String to Bool spec Jorge Solórzano <jorsol@gmail.com>
Re: [JDBC] JDBC String to Bool spec Jorge Solórzano <jorsol@gmail.com>
Re: [JDBC] JDBC String to Bool spec Kevin Wooten <kdubb@me.com>
Re: JDBC String to Bool spec Jorge Solórzano <jorsol@gmail.com>
Re: [JDBC] JDBC String to Bool spec Mark Rotteveel <mark@lawinegevaar.nl>
Re: JDBC String to Bool spec Jorge Solórzano <jorsol@gmail.com>
Re: [JDBC] JDBC String to Bool spec Dave Cramer <pg@fastcrypt.com>
Re: [JDBC] JDBC String to Bool spec Kevin Wooten <kdubb@me.com>
Re: JDBC String to Bool spec Kevin Wooten <kdubb@me.com>
Re: JDBC String to Bool spec Jorge Solórzano <jorsol@gmail.com>
Re: [JDBC] JDBC String to Bool spec rob stone <floriparob@gmail.com>
Re: [JDBC] JDBC String to Bool spec Kevin Wooten <kdubb@me.com>
Re: JDBC String to Bool spec Dave Cramer <pg@fastcrypt.com>
Re: [JDBC] JDBC String to Bool spec "David G. Johnston" <david.g.johnston@gmail.com>
Re: JDBC String to Bool spec Jorge Solórzano <jorsol@gmail.com>
Re: [JDBC] JDBC String to Bool spec Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
On 2017-01-16 20:16, Jorge Solórzano wrote:
> I guess you are right, the driver currently blindly converts incorrect
> values to false, IMO it should accept only values allowed in
> postgresql server since this is the PgJBDC driver, but is should also
> support a cast of float, double and decimal as this is required by the
> jdbc spec.

Interestingly, the JDBC 4.2 specification documentation allows more 
types than the apidoc (see my previous email for a quote of the apidoc). 
I will see if I can get Lance Andersen to amend the apidoc.

The JDBC specification mentions conversion for: TINYINT, SMALLINT, 
INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, BOOLEAN, 
CHAR, VARCHAR, LONGVARCHAR (and vice versa), the apidoc doesn't mention 
the fixed and floating point types. Presumably this was added because 
you can also call getInt on a double, etc.

> @vlsi, @davecramer, what is your opinion about blindly convert
> incorrect values to false? Should the driver accept this kind of
> behaviour?
> 
> For instance something like this is allowed (and there is even a test
> for this):
> 
> CREATE TABLE testboolstring (a varchar(30));
> INSERT INTO testboolstring VALUES('this is not true');
> 
> when execute rs.getBoolean(1), it gets false, but it should be an
> cannotCastException.

You're right, but the question is: will you break existing code if you 
apply this change?

Mark

В списке pgsql-jdbc по дате отправления
От: Vladimir Sitnikov
Дата:
Сообщение: Re: JDBC String to Bool spec
От: Dave Cramer
Дата:
FAQ