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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane wrote:
Mark Rostron <mrostron@xxxxxxx> writes:
Is there some way to query the data-type of '<some value expression>'?

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/UserDefinedTypesAndRoutines.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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux