Re: interperting type oid in C code

From: Ken Been <kbbeen(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Melvin Davidson <melvin6925(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: interperting type oid in C code
Date: 2015-10-19 19:38:59
Message-ID: CANe84rxO=ebDvnB6CP00wBRNKqfaz72dHfRiAZyJBaW1Tm_aCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Those are more complicated, and it's not obvious to me how to use them. I
really think that all I need is something as simple as "if (my_oid ==
INT4OID) {...}". Is there any reason why I shouldn't just do that?

On Mon, Oct 19, 2015 at 7:08 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:

> Ken Been wrote:
> > Thanks, but I actually wanted to do it from C code. But anyway I think I
> > found the answer: use the symbolic constants in catalog/pg_type.h, such
> as
> > INT4OID.
>
> You can probably use
> SearchSysCache1(TYPEOID, ObjectIdGetDatum(your_oid))
> or perhaps
> lookup_type_cache(your_oid).
>
> --
> Álvaro Herrera http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2015-10-19 19:40:40 Re: interperting type oid in C code
Previous Message Alvaro Herrera 2015-10-19 19:08:41 Re: interperting type oid in C code