pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedArray type error
4+ messages / 2 participants
[nested] [flat]
* Array type error
@ 2011-02-14 10:28 RW Shore <rws228@gmail.com>
2011-02-14 11:29 ` Re: Array type error Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 4+ messages in thread
From: RW Shore @ 2011-02-14 10:28 UTC (permalink / raw)
To: pgsql-jdbc
PostgreSQL version: 9.0-801
Server host: Windows 7
I have a table with an attribute declared as a boolean array. As expected,
when I query this table and extract a value for this attribute via
getObject( ), I get an object of type java.sql.Array. However, the
getBaseType( ) method on this object returns java.sql.Types.BIT ( -7 )
rather than the correct value java.sql.Types.BOOLEAN (16).
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Array type error
2011-02-14 10:28 Array type error RW Shore <rws228@gmail.com>
@ 2011-02-14 11:29 ` Oliver Jowett <oliver@opencloud.com>
2011-02-14 12:52 ` Re: Array type error RW Shore <rws228@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Jowett @ 2011-02-14 11:29 UTC (permalink / raw)
To: RW Shore <rws228@gmail.com>; +Cc: pgsql-jdbc
RW Shore wrote:
> However, the
> getBaseType( ) method on this object returns java.sql.Types.BIT ( -7 )
> rather than the correct value java.sql.Types.BOOLEAN (16).
These types are effectively interchangeable in JDBC.
See the list archives for past discussion.
Oliver
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Array type error
2011-02-14 10:28 Array type error RW Shore <rws228@gmail.com>
2011-02-14 11:29 ` Re: Array type error Oliver Jowett <oliver@opencloud.com>
@ 2011-02-14 12:52 ` RW Shore <rws228@gmail.com>
2011-02-14 13:13 ` Re: Array type error Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 4+ messages in thread
From: RW Shore @ 2011-02-14 12:52 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc
Thanks for the response. My issue is that the input and output formats
aren't interchangable. The application in question is part of a replication
system that converts changes into XML, processes the changes, and ultimately
applies them to a target database. If the array instance says that it
contains BIT data, I try to extract the array contents as a binary array;
this won't work if the actual array contents are BOOLEAN. Also, as far as I
can tell, the only way to insert an array value is to stringify it; the
string representation for a bit array is quite different from that of a
boolean array.
I understand the interchangability of bit(1) and boolean at a certain level,
but IMO this is still an inconsistency at best if not an outright bug.
On Mon, Feb 14, 2011 at 6:29 AM, Oliver Jowett <oliver@opencloud.com> wrote:
> RW Shore wrote:
>
>> However, the getBaseType( ) method on this object returns
>> java.sql.Types.BIT ( -7 ) rather than the correct value
>> java.sql.Types.BOOLEAN (16).
>>
>
> These types are effectively interchangeable in JDBC.
> See the list archives for past discussion.
>
> Oliver
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Array type error
2011-02-14 10:28 Array type error RW Shore <rws228@gmail.com>
2011-02-14 11:29 ` Re: Array type error Oliver Jowett <oliver@opencloud.com>
2011-02-14 12:52 ` Re: Array type error RW Shore <rws228@gmail.com>
@ 2011-02-14 13:13 ` Oliver Jowett <oliver@opencloud.com>
0 siblings, 0 replies; 4+ messages in thread
From: Oliver Jowett @ 2011-02-14 13:13 UTC (permalink / raw)
To: RW Shore <rws228@gmail.com>; +Cc: pgsql-jdbc
On 15/02/11 01:52, RW Shore wrote:
> I understand the interchangability of bit(1) and boolean at a certain
> level, but IMO this is still an inconsistency at best if not an outright
> bug.
I didn't mean that the server-side types bit(1) and boolean were
interchangeable. I meant that at the JDBC level, Types.BIT and
Types.BOOLEAN mean the same thing - the boolean type. BIT doesn't really
map to the server-side bit(n) type at all.
BOOLEAN is only available in later JDBC versions, so the driver prefers
BIT when returning metadata.
Oliver
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2011-02-14 13:13 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 10:28 Array type error RW Shore <rws228@gmail.com>
2011-02-14 11:29 ` Oliver Jowett <oliver@opencloud.com>
2011-02-14 12:52 ` RW Shore <rws228@gmail.com>
2011-02-14 13:13 ` Oliver Jowett <oliver@opencloud.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox