Thread

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

    Jered Floyd <jered@permabit.com> — 2001-02-07T08:15:06Z

    ============================================================================
                            POSTGRESQL BUG REPORT TEMPLATE
    ============================================================================
    
    
    Your name		:	Jered Floyd
    Your email address	:	jered@permabit.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.)