Re: Determining the OID of a certain type

From: Carsten Kropf <ckropf2(at)fh-hof(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Determining the OID of a certain type
Date: 2010-03-22 15:15:17
Message-ID: 6B8BC362-4251-4386-9809-590034B2AED5@fh-hof.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks a lot,
basically I looked inside these functions in parse_type.c and did not find an "easy to use" application here. So I considered trying to construct the required arguments passed to typenameType. However, during the development, I found the following function:
Oid
TypenameGetTypid(const char *typname)
which does indeed do the lookup of my particular type in the cache and system catalog tables. Thanks a lot for the hint!
Best regards
Carsten Kropf
Am 22.03.2010 um 13:18 schrieb Tom Lane:

> Carsten Kropf <ckropf2(at)fh-hof(dot)de> writes:
>> I wanted to ask, if there is a method to determine the oid of a
>> certain type using the C backend interface?
>
> Starting from what?
>
> For built-in types it's usual practice to use the #define from
> pg_type.h, if there is one. If you have a string name for the type,
> there's a parser function to derive an OID, which I forget the name
> of but it's probably in parse_type.c.
>
> regards, tom lane
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-03-22 15:16:47 Re: Daylight savings time confusion
Previous Message Thom Brown 2010-03-22 14:36:10 Re: Reducing excess files in pg_xlog