Skip site navigation (1) Skip section navigation (2)

Re: determining a type oid from the name

From: Thom Brown <thom(at)linux(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: determining a type oid from the name
Date: 2012-02-22 18:28:33
Message-ID: CAA-aLv4hzyXNUmXfaSrtPyepPMhHec4_KRYG0N8m3=50OxymWw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 22 February 2012 18:00, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> Say I'm writing an extension X, and I want to process data values from
> another extension that creates type Y (e.g. an hstore), what's the best way
> to determine the Oid of type Y in my module X code? SPI code that runs
> "select 'something'::Y" and then examines the oid in SPI_tuptable? Or do we
> have a utility function I have missed that, given a type name and the
> current search path will give me back the type Oid?

Does this help?

test=# SELECT pg_typeof('4834.34'::numeric)::oid;
 pg_typeof
-----------
      1700
(1 row)

-- 
Thom

In response to

Responses

pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2012-02-22 18:34:04
Subject: Re: determining a type oid from the name
Previous:From: Andrew DunstanDate: 2012-02-22 18:00:55
Subject: determining a type oid from the name

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group