pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Pflug <Andreas.Pflug@web.de>
To: pgsql-odbc@postgresql.org
Subject: using domain types with ODBC, esp. lo
Date: Fri, 21 Mar 2003 17:19:51 +0100
Message-ID: <3E7B3BA7.20709@web.de> (raw)

In my schema definitions, I usually don't use basic datatypes, but self 
defined domains. This seems to work in general, but I encountered 
problems with blobs.
I'm using CREATE DOMAIN t_image AS lo;
While inserting data isn't sensitive to domains, selecting won't work. 
The reason is that the row's datatype obtained with CI_read_fields is 
compared to lo's oid. t_image's oid is different, so the column is 
handled wrong. This means, that at the moment domains are not usable on 
lo columns with ODBC.
As a workaround, the driver could maintain an internal list of domain's 
oids, mapping them to lo's oid when CI_read_fields detects one.

There might be another flaw inside CI_read_fields.
The well-known data types PG_TYPE_DATETIME, PG_TYPE_TIMESTAMP_NO_TMZONE, 
PG_TYPE_TIME, PT_TYPE_TIME_WITH_TMZONE are handled in a special way 
concerning the atttypmod field. This will fail for domain types of that 
base type.

Actually, best thing for this problems would be if the backend would 
deliver the base type oid, not the user type oid.
And lo could be hard-coded to the backend too... :-)

Regards,

Andreas




view thread (3+ messages)  latest in thread

Message-ID: <3E7B3BA7.20709@web.de>
Permalink:  ../3E7B3BA7.20709@web.de/
Also on:    postgresql.org/message-id/3E7B3BA7.20709@web.de

 · 

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: Andreas.Pflug@web.de, pgsql-odbc@postgresql.org
  Subject: Re: using domain types with ODBC, esp. lo
  In-Reply-To: <3E7B3BA7.20709@web.de>

* 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