pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: PG-Interfaces <pgsql-interfaces@postgreSQL.org>
Subject: Re: [INTERFACES] OIDs in pg_type stable across versions?
Date: Wed, 20 Jan 1999 10:55:28 -0500
Message-ID: <6602.916847728@sss.pgh.pa.us> (raw)
In-Reply-To: <lt7lui6oxf.fsf@Guido.Goldstein.dialup.t-online.de>

Guido.Goldstein@t-online.de (Guido Goldstein) writes:
> 	Eric Marsden <emarsden@mail.dotcom.fr> wrote:
>> 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.

Guido's right.  The predefined types (like INT4) have permanently
assigned OIDs, but array types and user-defined types are entered
into the table on-the-fly.  Just reloading the database would likely
change their OIDs, let alone moving to a different version.  Also,
I believe different databases within a single installation have
separate pg_type tables, which are likely to have only the system
types in common.

> 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.

I don't think a listen on pg_type would do anything; the system doesn't
issue notifies when changing system tables, AFAIK.  But what you could
do is pull the pg_type table at connection startup, and subsequently
whenever you see a type OID that you haven't got any info about, do
"SELECT ... FROM pg_type WHERE oid = xxx" to add the info to your
table.  Under normal use that wouldn't happen very often, I imagine.

			regards, tom lane



view thread (3+ messages)

Message-ID: <6602.916847728@sss.pgh.pa.us>
Permalink:  ../6602.916847728@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6602.916847728@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us
  Subject: Re: [INTERFACES] OIDs in pg_type stable across versions?
  In-Reply-To: <6602.916847728@sss.pgh.pa.us>

* 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