Re: getting type name - Mailing list pgsql-hackers

From Tzahi Fadida
Subject Re: getting type name
Date
Msg-id 200607092208.42900.Tzahi.ML@gmail.com
Whole thread Raw
In response to Re: getting type name  (Michael Fuhr <mike@fuhr.org>)
Responses Re: getting type name  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
On Sunday 09 July 2006 21:49, Michael Fuhr wrote:
> On Sun, Jul 09, 2006 at 09:03:21PM +0300, Tzahi Fadida wrote:
> > How do i get a char * type from a type Oid. i.e.
> > getStringTypeFromOid(INT4OID) will return "int4".
>
> Server-side or client-side?  In the backend I think you could use

Backend.

> format_type_be() or format_type_with_typemod(), both declared in
> utils/builtins.h and defined in src/backend/utils/adt/format_type.c.

They return format_type_be(INT4OID) = "integer" or format_type_be(FLOAT8OID)
= "double precision"
I need to use this in a query with the "::" cast operator.
There is a function SPI_gettype but it works on relations. I wish to work
directly with the oid types without opening a relation.

10x.

--
Regards,
        Tzahi.
--
Tzahi Fadida
Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
WARNING TO SPAMMERS:  see at
http://members.lycos.co.uk/my2nis/spamwarning.html


pgsql-hackers by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: getting type name
Next
From: Martijn van Oosterhout
Date:
Subject: Re: getting type name