JDBC driver doesn't allow access to BYTEA types via get/setBytes()

From: Jered Floyd <jered(at)permabit(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Cc: dev-server(at)permabit(dot)com
Subject: JDBC driver doesn't allow access to BYTEA types via get/setBytes()
Date: 2001-02-07 08:15:06
Message-ID: 87snlqsyd1.fsf@irregular-apocalypse.permabit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Jered Floyd
Your email address : jered(at)permabit(dot)com

System Configuration
---------------------
Architecture (example: Intel Pentium) : x86

Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.17

PostgreSQL version (example: PostgreSQL-7.0): PostgreSQL-7.0.3

Compiler used (example: gcc 2.8.0) : gcc 2.95.2

Please enter a FULL description of your problem:
------------------------------------------------

The JDBC driver doesn't provide an interface to access BYTEA types, as
get/setBytes() have been co-opted to operate on BLOBs. This is
frustrating as JDBC says this is for operating on both VARBINARY and
LONGVARBINARY SQL92 types, and BYTEA is the closest to VARBINARY that
we've got.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

Performing an update to a BYTEA field value set with setBytes() yields:
"Attribute 'vhandle' is of type 'bytea' but expression is of type 'int4'"
because the JDBC driver is trying to store the OID for a LOB it created.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

get/setBytes() should be extended to handle both BYTEA and OID types
as appropriate.

I think (hope) the JDBC driver is a moving target, so I'll take a look
at this issue when I move over to using 7.1beta (after I've beaten 7.0
into submission.)

Browse pgsql-bugs by date

  From Date Subject
Next Message Jered Floyd 2001-02-07 08:16:17 byteain() doesn't parse correctly
Previous Message Jered Floyd 2001-02-07 08:13:49 JDBC driver throws unfriendly exceptions