Search Postgresql Archives

Re: [libpq] OIDs of extension types? Of custom types?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dominique Devienne <ddevienne@xxxxxxxxx> writes:
> On Fri, Oct 14, 2022 at 2:31 PM Laurenz Albe <laurenz.albe@xxxxxxxxxxx> wrote:
>> You use the #defines like TEXTOID for the built-in Oids, right?

> I don't. I used
> https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat
> as a reference.
> I suspect that should be fairly stable, right? I have at least 2 or 3
> dozen OIDs pairs (scalar + array) of primitives
> and other types (Oid, Name, Text, Bytea, Uuid, etc...). Are there
> #defines for all of those? Where?

They're stable, but writing magic numbers leads to unreadable code.
Use the macros from catalog/pg_type_d.h.

>> For types from an extensions, you would run a query on "pg_type".

>  OK, thanks.

In SQL queries, you can avoid hard-wiring anything by writing
things like "'hstore'::regtype".  It may or may not be possible
to avoid fetching the OID altogether that way.

			regards, tom lane






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux