Re: Using boolean '1' in jdbc2

From: Rene Pijlman <rene(at)lab(dot)applinet(dot)nl>
To: "Glenn R(dot) Kronschnabl" <grk(at)netquotient(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Using boolean '1' in jdbc2
Date: 2001-09-14 09:40:32
Message-ID: oej3qtcpc87frlt340hn3lm4t8r2kko5df@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 13 Sep 2001 22:58:23 -0500, you wrote:
>I have a schema & data from Oracle that uses a 'fake' boolean column.
>(Stupid oracle doesn't support type boolean afaik - uses number). I
>find the easiest way to adapt the schema & data to postgresql is to
>*not* convert the 'fake' boolean fields (enforced in Oracle using
>constraints) to postgresql boolean but to use either numeric(1) or
>integer.
[...]
>So - the submitted patch allows a boolean field to be implemented using
>either numeric or integer fields - I think this is pretty common.

Ah, I see.

Well, for what its worth, this is allowed by the JDBC spec. The
getXXX()/datatypes mapping table at the end of the JDBC book
says mapping getBoolean() to SQL BIT is recommended, but calling
it on TINYINT, SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE,
DECIMAL, NUMERIC, CHAR, VARCHAR, LONGVARCHAR is also allowed.

In fact, I think this means our driver is required to support
these mappings.

The book doesn't say how the values in these types should map to
true and false though.

I guess this means there is no objection to the patch. But
personally, I would prefer to do it right the first time for all
datatypes, rather than extending the if statement for every
request.

Regards,
René Pijlman <rene(at)lab(dot)applinet(dot)nl>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Rene Pijlman 2001-09-14 09:42:05 Re: Using boolean '1' in jdbc2
Previous Message Kaneda K 2001-09-14 09:22:53 Re: Using boolean '1' in jdbc2