pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how do i query the type of an object?
3+ messages / 3 participants
[nested] [flat]

* how do i query the type of an object?
@ 2010-08-12 00:37 Mark Rostron <mrostron@ql2.com>
  2010-08-12 01:39 ` Re: how do i query the type of an object? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Mark Rostron @ 2010-08-12 00:37 UTC (permalink / raw)
  To: pgsql-admin

Is there some way to query the data-type of '<some value expression>'?

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: how do i query the type of an object?
  2010-08-12 00:37 how do i query the type of an object? Mark Rostron <mrostron@ql2.com>
@ 2010-08-12 01:39 ` Tom Lane <tgl@sss.pgh.pa.us>
  2010-08-12 08:14   ` Re: how do i query the type of an object? Yeb Havinga <yebhavinga@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2010-08-12 01:39 UTC (permalink / raw)
  To: Mark Rostron <mrostron@ql2.com>; +Cc: pgsql-admin

Mark Rostron <mrostron@ql2.com> 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.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: how do i query the type of an object?
  2010-08-12 00:37 how do i query the type of an object? Mark Rostron <mrostron@ql2.com>
  2010-08-12 01:39 ` Re: how do i query the type of an object? Tom Lane <tgl@sss.pgh.pa.us>
@ 2010-08-12 08:14   ` Yeb Havinga <yebhavinga@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Yeb Havinga @ 2010-08-12 08:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Mark Rostron <mrostron@ql2.com>; pgsql-admin

Tom Lane wrote:
> Mark Rostron <mrostron@ql2.com> 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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2010-08-12 08:14 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-08-12 00:37 how do i query the type of an object? Mark Rostron <mrostron@ql2.com>
2010-08-12 01:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2010-08-12 08:14   ` Yeb Havinga <yebhavinga@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox