Re: PQftype() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PQftype()
Date
Msg-id 361.988668714@sss.pgh.pa.us
Whole thread Raw
In response to Re: PQftype()  ("Magnus Naeslund\(f\)" <mag@fbab.net>)
List pgsql-hackers
"Magnus Naeslund\(f\)" <mag@fbab.net> writes:
> Where do get a listing of what PQftype() can return to me?
>> 
>> select oid, typname from pg_type

> Does these change often?

The system type OIDs are stable.  User-defined types would probably have
a new OID after a dump and reload.

> Or could i do like the ODBC driver, autogenerate a .h out of that table.

I would not recommend relying on compiled-in OID knowledge for any types
other than the system-defined datatypes.  If you expect to have to deal
with user-defined types, it's best to cache the results of pg_type
lookups at the client end.  You need not worry about OIDs changing
during a single client connection.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Magnus Naeslund\(f\)"
Date:
Subject: Re: PQftype()
Next
From: Joel Burton
Date:
Subject: Re: COPY commands could use an enhancement.