Bug extracting bit value

From: Holger Schulz <hst1(at)online(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Bug extracting bit value
Date: 2006-10-01 10:57:17
Message-ID: bKGiHoZKhuw0FF0vBDRcMjj7JmqBR4ufH7XEELpMhkV@akmail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello!

When I extract a bit value by JDBC I get an Boolean Object - even for bit(3)!

CREATE TABLE testbits
(
cbitone bit(1),
cbitthree bit(3),
cvarbit varbit,
cboolean bool
)
INSERT INTO testbits
("cbitone", "cbitthree", "cvarbit", "cboolean") values
(
B'1',
B'101',
B'0101',
true
)
------------------

In Java:

select * from testbits

Object oValue = m_resultSet.getObject(i);

returns:
| cbitone | cbitthree | cvarbit | cboolean |
-|---------------------|---------------------|--------------------------------|---------------------|-
| true | false | 0101 | true |
| 'java.lang.Boolean' | 'java.lang.Boolean' | 'org.postgresql.util.PGobject' | 'java.lang.Boolean' |

------------------

When I use getString() instead of getObject() I get this result:

Object oValue = m_resultSet.getObject(i);

| cbitone | cbitthree | cvarbit | cboolean |
-|--------------------|--------------------|--------------------|--------------------|-
| '1' | '101' | '0101' | 't' |
| 'java.lang.String' | 'java.lang.String' | 'java.lang.String' | 'java.lang.String' |

------------------

Same statement in pgAdmin III returns:
1;101;"0101";t

------------------

Tested with:
PostgreSQL 8.1.4 on Windows 2000
JDBC driver: postgresql-8.2dev-503.jdbc3.jar AND postgresql-8.1-407.jdbc3.jar

Holger

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Paesold 2006-10-01 13:46:53 Re: [pgsql-jdbc] dollar-quoted CREATE FUNCTION statement fails
Previous Message Holger Schulz 2006-09-30 23:09:04 Bug extracting money value