Re: Boolean/Bit BUG with 7.4 JDBC Driver (build 213)

Lists: pgsql-jdbc
From: "j(dot)random(dot)programmer" <javadesigner(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Boolean/Bit BUG with 7.4 JDBC Driver (build 213)
Date: 2004-04-07 22:08:04
Message-ID: 20040407220804.63851.qmail@web14203.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi:

The latest JDBC driver (build 213) returns -7 for
the java.sql.Types value (obtained via DBMetaData,
getColumns() and then "DATA_TYPE"). I am not sure
if this has been a bug with all postgres JDBC drivers
or if this is some kinda regression bug.

-7 corresponds to a java.sql.Types.BIT and should
NOT be returned for a BOOLEAN type.

For a BOOLEAN type, a value of 16 should be returned
which corresponds to a java.sql.Types.BOOLEAN.

Please fix this ASAP, I am writing an advanced
db abstraction layer and although both boolean/bit
are suggested by sun to map to a java boolean type,
I still need to distinguish between bits and
booleans in case the user wants a different mapping.

So: 16 for boolean, NOT -7

Best regards,

--j

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html


From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: "j(dot)random(dot)programmer" <javadesigner(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Boolean/Bit BUG with 7.4 JDBC Driver (build 213)
Date: 2004-04-10 00:29:20
Message-ID: 40773FE0.6030904@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

j.random.programmer wrote:
> Hi:
>
> The latest JDBC driver (build 213) returns -7 for
> the java.sql.Types value (obtained via DBMetaData,
> getColumns() and then "DATA_TYPE"). I am not sure
> if this has been a bug with all postgres JDBC drivers
> or if this is some kinda regression bug.
>
> -7 corresponds to a java.sql.Types.BIT and should
> NOT be returned for a BOOLEAN type.
>
> For a BOOLEAN type, a value of 16 should be returned
> which corresponds to a java.sql.Types.BOOLEAN.

1) BOOLEAN exists only in JDBC3. What should the driver return for a
boolean column if JDBC1 or JDBC2 is in use?

2) JDBC3 explicitly says that either BOOLEAN or BIT may be returned for
a boolean data type. See the tables in appendix B of the specificaton
(pg. 175-180).

3) JDBC3 also says that "BOOLEAN is logically equivalent to BIT" (pg. 22).

> Please fix this ASAP, I am writing an advanced
> db abstraction layer and although both boolean/bit
> are suggested by sun to map to a java boolean type,
> I still need to distinguish between bits and
> booleans in case the user wants a different mapping.

Given that BIT and BOOLEAN are equivalent at the JDBC level I don't
quite see how this works.

What are the distinct underlying database types that would map to BIT
and BOOLEAN? AFAIK, postgresql only has one such datatype (bool/boolean).

If you think this is a bug in the driver and needs fixing rapidly, the
fastest way to get it fixed is to provide a patch.

-O


From: "j(dot)random(dot)programmer" <javadesigner(at)yahoo(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Boolean/Bit BUG with 7.4 JDBC Driver (build 213)
Date: 2004-04-17 02:27:17
Message-ID: 20040417022717.58735.qmail@web14207.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

I wrote:

> > The latest JDBC driver (build 213) returns -7 for
> > the java.sql.Types value (obtained via DBMetaData,
> > getColumns() and then "DATA_TYPE"). I am not sure
> > if this has been a bug with all postgres JDBC
> drivers
> > or if this is some kinda regression bug.
> >
> > -7 corresponds to a java.sql.Types.BIT and should
> > NOT be returned for a BOOLEAN type.
> >
> > For a BOOLEAN type, a value of 16 should be
> returned
> > which corresponds to a java.sql.Types.BOOLEAN.

Oliver wrote:


> 1) BOOLEAN exists only in JDBC3. What should the
> driver return for a
> boolean column if JDBC1 or JDBC2 is in use?

Hmm. I see. Maybe fallback to BIT for those and
return BOOLEAN it usinng JDBC3 ? But that may be
more trouble than it's worth.

> 2) JDBC3 explicitly says that either BOOLEAN or BIT
> may be returned for
> a boolean data type. See the tables in appendix B of
> the specificaton
> (pg. 175-180).

Ok. Thanks for pointing this out.

> 3) JDBC3 also says that "BOOLEAN is logically
> equivalent to BIT" (pg. 22).

Ok. Leave things the way they are. This is no big
deal in hindsight. In my database abstraction layer,
I have arranged to generate a 'getBoolean(..) method
for both BIT and BOOLEAN column types.

Best regards,

--j



__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html