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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Dominique Devienne <ddevienne(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: [libpq] OIDs of extension types? Of custom types?
Date: 2022-10-14 12:30:59
Message-ID: e413a7ce097b9f3beb015e42dfcb6f0d9d8eccea.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2022-10-14 at 13:39 +0200, Dominique Devienne wrote:
> Hi. I'm using binary binds and results for DMLs, as well as for COPY.
>
> So far, I've stayed within built-in scalar and array types, thus I
> could hardcode the OIDs of values "in the type-system" (in C++, via
> traits).
> But I'd like to venture into extension (e.g. hstore) and custom
> (enums, domain, etc...) types.
> Thus I'm wondering:
> 1) whether "official" extensions have fixed/stable OIDs, like in my
> hstore example. If so, where are they defined?
> 2) how should I be looking up OIDs for custom (or extension?) types
> with libpq? Any specific APIs? Or I need to do SQL instead?
> 3) If I duplicate custom types per-schema, to keep them standalone,
> they'll get different OIDs, right?

You use the #defines like TEXTOID for the built-in Oids, right?

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

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2022-10-14 12:33:36 Re: does postgres has snapshot standby feature?
Previous Message Laurenz Albe 2022-10-14 12:28:59 Re: Number of updated rows with LibPQ