Re: pgsql oid question - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pgsql oid question
Date
Msg-id 7633.1041756357@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql oid question  ("Reggie Burnett" <rykr@bellsouth.net>)
List pgsql-hackers
"Reggie Burnett" <rykr@bellsouth.net> writes:
> Ok, that adds some clarity.  Have base types (int32, etc) had the same
> oid values for a significant number of versions of PgSQL?  What I am
> getting at is this:  can I hard code oid values into an access layer for
> PgSQL?

AFAIK, we have never renumbered an existing standard type.  But we
reserve the right to do it.  Also, base types have appeared and
disappeared in living memory (eg, datetime).

Minimum prudence would be to #include pg_type.h and then write INT4OID
rather than 23 (for example).  A more paranoid approach is to establish
a typename<->oid cache on the client side and not believe anything you
haven't probed during the current connection.  The Java driver takes the
paranoid approach, but some other clients such as the ODBC driver rely
on #defines.  The tradeoffs are pretty obvious, so make your own choice
about what to do.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Reggie Burnett"
Date:
Subject: Re: pgsql oid question
Next
From: Peter Mount
Date:
Subject: Re: New Portal in Place, DNS switched ...