Re: [HACKERS] determining a type oid from the name

2012-02-22 Thread Thom Brown
On 22 February 2012 18:00, Andrew Dunstan and...@dunslane.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

Re: [HACKERS] determining a type oid from the name

2012-02-22 Thread Kevin Grittner
Thom Brown t...@linux.com wrote: Does this help? test=# SELECT pg_typeof('4834.34'::numeric)::oid; pg_typeof --- 1700 (1 row) Wouldn't it be easier to do this instead? test=# SELECT 'numeric'::regtype::oid; oid -- 1700 (1 row) -Kevin -- Sent via pgsql-hackers

Re: [HACKERS] determining a type oid from the name

2012-02-22 Thread Thom Brown
On 22 February 2012 18:34, Kevin Grittner kevin.gritt...@wicourts.gov wrote: Thom Brown t...@linux.com wrote: Does this help? test=# SELECT pg_typeof('4834.34'::numeric)::oid;  pg_typeof ---       1700 (1 row) Wouldn't it be easier to do this instead? test=# SELECT

Re: [HACKERS] determining a type oid from the name

2012-02-22 Thread Andrew Dunstan
On 02/22/2012 01:36 PM, Thom Brown wrote: On 22 February 2012 18:34, Kevin Grittnerkevin.gritt...@wicourts.gov wrote: Thom Brownt...@linux.com wrote: Does this help? test=# SELECT pg_typeof('4834.34'::numeric)::oid; pg_typeof --- 1700 (1 row) Wouldn't it be easier to do

Re: [HACKERS] determining a type oid from the name

2012-02-22 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: Maybe I need to be more clear. The C code I'm writing will process composites. I want to cache the Oids of certain non-builtin types in the function info's fn_extra, and then be able to test whether or not the fields in the composites are of those

Re: [HACKERS] determining a type oid from the name

2012-02-22 Thread Andrew Dunstan
On 02/22/2012 03:20 PM, Tom Lane wrote: Andrew Dunstanand...@dunslane.net writes: Maybe I need to be more clear. The C code I'm writing will process composites. I want to cache the Oids of certain non-builtin types in the function info's fn_extra, and then be able to test whether or not the

Re: [HACKERS] determining a type oid from the name

2012-02-22 Thread Dimitri Fontaine
Andrew Dunstan and...@dunslane.net writes: I fully agree it's not bulletproof, but I'm not sure what alternative there is. If you know the type has been installed as an extension you can look at the extension's content in pg_depend, much like \dx+ does, limiting to only types whose name