Re: BLOB handling compatibility with PostgreSQL > 7.4

From: Ludek Finstrle <luf(at)pzkagis(dot)cz>
To: Irina Sourikova <irina(at)bnl(dot)gov>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: BLOB handling compatibility with PostgreSQL > 7.4
Date: 2005-12-06 22:25:30
Message-ID: 20051206222530.GA25779@soptik.pzkagis.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-odbc

> We would like to upgrade the Postgres version from our current 7.3 but
> have problems with handling BLOBs via ODBC.
> We use unixODBC-2.2.11 and psqlodbc-08.01.0101.
> With postgres 7.3 lo type was mapped to SQL_C_BINARY and that's changed
> since postgres 7.4.
> Is it an ODBC or a driver issue? Are there any plans to fix the problem?

This is backend change. You have to change your type definition.

Your type is now:
CREATE DOMAIN lo AS oid;
This doesn't work since PgSQL 7.4 becouse backend returns type oid for
base type (oid not lo).

New way since PgSQL 7.4:
CREATE FUNCTION loin (cstring) RETURNS lo AS 'oidin' LANGUAGE internal IMMUTABLE STRICT;
CREATE FUNCTION loout (lo) RETURNS cstring AS 'oidout' LANGUAGE internal IMMUTABLE STRICT;
CREATE FUNCTION lorecv (internal) RETURNS lo AS 'oidrecv' LANGUAGE internal IMMUTABLE STRICT;
CREATE FUNCTION losend (lo) RETURNS bytea AS 'oidrecv' LANGUAGE internal IMMUTABLE STRICT;

CREATE TYPE lo ( INPUT = loin, OUTPUT = loout, RECEIVE = lorecv, SEND = losend, INTERNALLENGTH = 4, PASSEDBYVALUE );
CREATE CAST (lo AS oid) WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (oid AS lo) WITHOUT FUNCTION AS IMPLICIT;

This way works. I tested it here againist PgSQL 8.1. I looked at PgSQL 7.4
documentation and this way may be supported.
Oh, I read faq (too late) and there is described similar way.

Maybe this can be added to FAQ as this way is more complex.

Luf

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Marc Herbert 2005-12-07 11:21:46 Re: BLOB handling compatibility with PostgreSQL > 7.4
Previous Message Ludek Finstrle 2005-12-06 21:50:22 Re: [ODBC] BLOB handling compatibility with PostgreSQL > 7.4

Browse pgsql-odbc by date

  From Date Subject
Next Message Ludek Finstrle 2005-12-06 22:32:36 Re: ERROR - no error information available
Previous Message Ludek Finstrle 2005-12-06 21:50:22 Re: [ODBC] BLOB handling compatibility with PostgreSQL > 7.4