Lists: | pgsql-interfaces |
---|
From: | Eric Marsden <emarsden(at)mail(dot)dotcom(dot)fr> |
---|---|
To: | pgsql-interfaces(at)postgreSQL(dot)org |
Subject: | OIDs in pg_type stable across versions? |
Date: | 1999-01-20 10:16:31 |
Message-ID: | wzi3e56ckqo.fsf@mail.dotcom.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-interfaces |
Hello,
I have written a socket-level interface to PostgreSQL for scsh, an
implementation of the Scheme programming language which provides a
POSIX interface. Unlike Tcl or Perl, Scheme distinguishes between
numbers and strings and booleans and so on (it's a real programming
language :), so I'm looking at how it might be possible to convert
data retrieved from the backend as a character stream into the
appropriate Scheme types.
The fe-be protocol seems to provide sufficient information to do this
type coercion: when the backend sends the attribute data in response
to a SELECT statement, it sends a sequence of tuples (name, type-id,
size). The type-id is an OID from the pg_type table.
Is is reasonable to assume that these oids will be stable across
versions and platforms, or will I have to reconstruct a table from
a `SELECT typname, oid FROM pg_type' each time a connection is
initiated?
(or maybe there's some simpler way to do the type coercions?)
--
Eric Marsden
emarsden @ mail.dotcom.fr
It's elephants all the way down
From: | Guido(dot)Goldstein(at)t-online(dot)de (Guido Goldstein) |
---|---|
To: | PG-Interfaces <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: [INTERFACES] OIDs in pg_type stable across versions? |
Date: | 1999-01-20 13:42:36 |
Message-ID: | lt7lui6oxf.fsf@Guido.Goldstein.dialup.t-online.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-interfaces |
Moin!
On 20 Jan 1999 11:16:31 +0100
Eric Marsden <emarsden(at)mail(dot)dotcom(dot)fr> wrote:
[snipped - low level interface for scheme]
> The fe-be protocol seems to provide sufficient information to do this
> type coercion: when the backend sends the attribute data in response
> to a SELECT statement, it sends a sequence of tuples (name, type-id,
> size). The type-id is an OID from the pg_type table.
>
> Is is reasonable to assume that these oids will be stable across
> versions and platforms, or will I have to reconstruct a table from
> a `SELECT typname, oid FROM pg_type' each time a connection is
> initiated?
I think, yes you should. Think of user defined types! They will be
stored in pg_types also.
What you can do is: cache and share this type information between all
connections initiated from this process. And then, from time to time,
reload the type information -- or intercept all changes on pg_type
('listen' command) and reload your type infos then.
> (or maybe there's some simpler way to do the type coercions?)
Not in my field of vision.
HAND
Guido
--
In the beginning there was nothing, and then even that exploded