Re: Using boolean '1' in jdbc2 - Mailing list pgsql-jdbc

From Rene Pijlman
Subject Re: Using boolean '1' in jdbc2
Date
Msg-id oej3qtcpc87frlt340hn3lm4t8r2kko5df@4ax.com
Whole thread Raw
In response to Re: Using boolean '1' in jdbc2  ("Glenn R. Kronschnabl" <grk@netquotient.com>)
List 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@lab.applinet.nl>

pgsql-jdbc by date:

Previous
From: Kaneda K
Date:
Subject: Re: Using boolean '1' in jdbc2
Next
From: Rene Pijlman
Date:
Subject: Re: Using boolean '1' in jdbc2