pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ludek Finstrle <luf@pzkagis.cz>
To: Irina Sourikova <irina@bnl.gov>
Cc: pgsql-odbc@postgresql.org
Subject: Re: BLOB handling compatibility with PostgreSQL > 7.4
Date: Tue, 6 Dec 2005 23:25:30 +0100
Message-ID: <20051206222530.GA25779@soptik.pzkagis.cz> (raw)
In-Reply-To: <438B792D.6030802@bnl.gov>
References: <438B792D.6030802@bnl.gov>

> 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



view thread (24+ messages)  latest in thread

Message-ID: <20051206222530.GA25779@soptik.pzkagis.cz>
Permalink:  ../20051206222530.GA25779@soptik.pzkagis.cz/
Also on:    postgresql.org/message-id/20051206222530.GA25779@soptik.pzkagis.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: luf@pzkagis.cz, irina@bnl.gov, pgsql-odbc@postgresql.org
  Subject: Re: BLOB handling compatibility with PostgreSQL > 7.4
  In-Reply-To: <20051206222530.GA25779@soptik.pzkagis.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox