You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by "Richard Bounds (JIRA)" <ji...@apache.org> on 2007/03/01 13:09:50 UTC

[jira] Created: (DDLUTILS-161) PostgreSQL Blob type mapping should be OID in v8

PostgreSQL Blob type mapping should be OID in v8
------------------------------------------------

                 Key: DDLUTILS-161
                 URL: https://issues.apache.org/jira/browse/DDLUTILS-161
             Project: DdlUtils
          Issue Type: Bug
          Components: Core - PostgreSql
         Environment: PostgreSQL 8.1.8 on Fedora core 6 (i386).
            Reporter: Richard Bounds
         Assigned To: Thomas Dudziak


For PostgreSQL v8 JDBC drivers the blob type maps to OID, not BYTEA:
from here: http://doc.postgresintl.com/jdbc/ch08.html
 "....To use the Large Object functionality you can use either the LargeObject class provided by the PostgreSQL™ JDBC driver, or by using the getBLOB() and setBLOB() methods...." 

When using PostgreSQL (v7 or v8) with the v7 JDBC drivers BYTEA works fine, but with the v8 drivers you get an error message:
ERROR: column "binvalue" is of type bytea but expression is of type oid


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DDLUTILS-161) PostgreSQL Blob type mapping should be OID in v8

Posted by "Richard Bounds (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DDLUTILS-161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Bounds updated DDLUTILS-161:
------------------------------------

    Attachment: TestPostgresBlob.java

Unit test to reproduce the problem.

> PostgreSQL Blob type mapping should be OID in v8
> ------------------------------------------------
>
>                 Key: DDLUTILS-161
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-161
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - PostgreSql
>         Environment: PostgreSQL 8.1.8 on Fedora core 6 (i386).
>            Reporter: Richard Bounds
>         Assigned To: Thomas Dudziak
>         Attachments: TestPostgresBlob.java
>
>
> For PostgreSQL v8 JDBC drivers the blob type maps to OID, not BYTEA:
> from here: http://doc.postgresintl.com/jdbc/ch08.html
>  "....To use the Large Object functionality you can use either the LargeObject class provided by the PostgreSQL™ JDBC driver, or by using the getBLOB() and setBLOB() methods...." 
> When using PostgreSQL (v7 or v8) with the v7 JDBC drivers BYTEA works fine, but with the v8 drivers you get an error message:
> ERROR: column "binvalue" is of type bytea but expression is of type oid

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DDLUTILS-161) PostgreSQL Blob type mapping should be OID in v8

Posted by "Richard Bounds (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DDLUTILS-161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12479308 ] 

Richard Bounds commented on DDLUTILS-161:
-----------------------------------------

I'm actually using Hibernate to access the database, but I think the attached unit test reproduces the problem more simply with plain JDBC - it creates a table, inserts a row with a blob, copies the blob to a new row, then deletes the table. When the table has a column of type OID, everything seems fine. When it is BYTEA I get the following exception:
org.postgresql.util.PSQLException: ERROR: column "photo" is of type bytea but expression is of type integer
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308)
	at TestPostgresBlob.testBlob(TestPostgresBlob.java:69)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)

For some reason I can reproduce this with either set of Drivers - I guess perhaps Hibernate is doing something to detect the V7 drivers.

> PostgreSQL Blob type mapping should be OID in v8
> ------------------------------------------------
>
>                 Key: DDLUTILS-161
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-161
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - PostgreSql
>         Environment: PostgreSQL 8.1.8 on Fedora core 6 (i386).
>            Reporter: Richard Bounds
>         Assigned To: Thomas Dudziak
>
> For PostgreSQL v8 JDBC drivers the blob type maps to OID, not BYTEA:
> from here: http://doc.postgresintl.com/jdbc/ch08.html
>  "....To use the Large Object functionality you can use either the LargeObject class provided by the PostgreSQL™ JDBC driver, or by using the getBLOB() and setBLOB() methods...." 
> When using PostgreSQL (v7 or v8) with the v7 JDBC drivers BYTEA works fine, but with the v8 drivers you get an error message:
> ERROR: column "binvalue" is of type bytea but expression is of type oid

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DDLUTILS-161) PostgreSQL Blob type mapping should be OID in v8

Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DDLUTILS-161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Dudziak updated DDLUTILS-161:
------------------------------------

    Fix Version/s: 1.2

> PostgreSQL Blob type mapping should be OID in v8
> ------------------------------------------------
>
>                 Key: DDLUTILS-161
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-161
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - PostgreSql
>         Environment: PostgreSQL 8.1.8 on Fedora core 6 (i386).
>            Reporter: Richard Bounds
>            Assignee: Thomas Dudziak
>             Fix For: 1.2
>
>         Attachments: TestPostgresBlob.java
>
>
> For PostgreSQL v8 JDBC drivers the blob type maps to OID, not BYTEA:
> from here: http://doc.postgresintl.com/jdbc/ch08.html
>  "....To use the Large Object functionality you can use either the LargeObject class provided by the PostgreSQL™ JDBC driver, or by using the getBLOB() and setBLOB() methods...." 
> When using PostgreSQL (v7 or v8) with the v7 JDBC drivers BYTEA works fine, but with the v8 drivers you get an error message:
> ERROR: column "binvalue" is of type bytea but expression is of type oid

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DDLUTILS-161) PostgreSQL Blob type mapping should be OID in v8

Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DDLUTILS-161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478693 ] 

Thomas Dudziak commented on DDLUTILS-161:
-----------------------------------------

Mhmm, AFAICT bytea is the correct type (see e.g. http://www.postgresql.org/docs/8.1/static/datatype-binary.html vs. http://www.postgresql.org/docs/8.1/static/datatype-oid.html). Also, blobs work fine (there are unit tests for that and they pass in PostgreSql 8.1 using the 8.1 driver).
Could you give more info as to what you did to produce this error ? E.g. the model XML, the connection info, Ant/code snippet etc.

> PostgreSQL Blob type mapping should be OID in v8
> ------------------------------------------------
>
>                 Key: DDLUTILS-161
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-161
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - PostgreSql
>         Environment: PostgreSQL 8.1.8 on Fedora core 6 (i386).
>            Reporter: Richard Bounds
>         Assigned To: Thomas Dudziak
>
> For PostgreSQL v8 JDBC drivers the blob type maps to OID, not BYTEA:
> from here: http://doc.postgresintl.com/jdbc/ch08.html
>  "....To use the Large Object functionality you can use either the LargeObject class provided by the PostgreSQL™ JDBC driver, or by using the getBLOB() and setBLOB() methods...." 
> When using PostgreSQL (v7 or v8) with the v7 JDBC drivers BYTEA works fine, but with the v8 drivers you get an error message:
> ERROR: column "binvalue" is of type bytea but expression is of type oid

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.