how do i query the type of an object?

how do i query the type of an object?

am 12.08.2010 02:37:20 von Mark Rostron

--_000_FD020D3E50E7FA479567872E5F5F31E30459E0E83Cex01corpql2 co_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Is there some way to query the data-type of ''?


--_000_FD020D3E50E7FA479567872E5F5F31E30459E0E83Cex01corpql2 co_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40"> =3D"text/html; charset=3Dus-ascii"> oft Word 14 (filtered medium)"> nk=3Dpurple>

Is there some wa=
y to query the data-type of ‘<some value expression>’? p>

 

=

--_000_FD020D3E50E7FA479567872E5F5F31E30459E0E83Cex01corpql2 co_--

Re: how do i query the type of an object?

am 12.08.2010 03:39:58 von Tom Lane

Mark Rostron writes:
> Is there some way to query the data-type of ''?

There's a SQL-standard construct called IS OF, and a function called
pg_typeof, but it's not real clear whether either of those would help
you.

regards, tom lane

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: how do i query the type of an object?

am 12.08.2010 10:14:59 von Yeb Havinga

Tom Lane wrote:
> Mark Rostron writes:
>
>> Is there some way to query the data-type of ''?
>>
>
> There's a SQL-standard construct called IS OF, and a function called
> pg_typeof, but it's not real clear whether either of those would help
> you.
>
I failed finding IS OF in the pg documentation, however,
http://farrago.sourceforge.net/design/UserDefinedTypesAndRou tines.html
had a reference to it.

postgres=# create table a(a) as select 1;
SELECT 1
postgres=# select * from a where a IS OF (integer);
a
---
1
(1 row)

While learning this somehow triggers the 'cool I just learned some new
obscure SQL trick' feeling, I am not sure if it is really useful without
CREATE TYPE foo UNDER bar.

regards,
Yeb Havinga


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin