pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yeb Havinga <yebhavinga@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Mark Rostron <mrostron@ql2.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: how do i query the type of an object?
Date: Thu, 12 Aug 2010 10:14:59 +0200
Message-ID: <4C63AD83.3060602@gmail.com> (raw)
In-Reply-To: <1823.1281577198@sss.pgh.pa.us>
References: <FD020D3E50E7FA479567872E5F5F31E30459E0E83C@ex01.corp.ql2.com>
	<1823.1281577198@sss.pgh.pa.us>

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




view thread (3+ messages)

Message-ID: <4C63AD83.3060602@gmail.com>
Permalink:  ../4C63AD83.3060602@gmail.com/
Also on:    postgresql.org/message-id/4C63AD83.3060602@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: yebhavinga@gmail.com, tgl@sss.pgh.pa.us, mrostron@ql2.com
  Subject: Re: how do i query the type of an object?
  In-Reply-To: <4C63AD83.3060602@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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