Array type error
Array type error
От:
RW Shore <rws228@gmail.com>
Дата:
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).
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).
Re: Array type error
От:
Oliver Jowett <oliver@opencloud.com>
Дата:
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
Re: Array type error
От:
RW Shore <rws228@gmail.com>
Дата:
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.
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:These types are effectively interchangeable in JDBC.However, the getBaseType( ) method on this object returns java.sql.Types.BIT ( -7 ) rather than the correct value java.sql.Types.BOOLEAN (16).
See the list archives for past discussion.
Oliver
Re: Array type error
От:
Oliver Jowett <oliver@opencloud.com>
Дата:
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