Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C9CAE6329A6 for ; Thu, 12 Aug 2010 05:13:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 79447-09 for ; Thu, 12 Aug 2010 08:12:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f46.google.com (mail-ew0-f46.google.com [209.85.215.46]) by mail.postgresql.org (Postfix) with ESMTP id 450FA633B43 for ; Thu, 12 Aug 2010 05:12:56 -0300 (ADT) Received: by ewy23 with SMTP id 23so498378ewy.19 for ; Thu, 12 Aug 2010 01:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=nlB8+bPTO/RxXJko0HkHC1U+Poa5uiAOjbI0a+RFTpM=; b=UTEMQfavIGXRQmnV+IluGzw0aanEPCAxvVJ0vgi9uUd5ltdKAw7FdCC+pNjcRx6ItD oi2uD9gMtjw+XfPyhfo11Bld6RxYZ908+dzzJj+6nru/jP7VOUGNkWQ5SWdu6hVZaBEz fMlcakiZtwTltOmMieabC0F2ddjawi1sMcjF4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=g8EfEGZ6D6J0ax4gNPGCDVOqlgLydnvLCphaYuDYfGIBZisa4DVwj1gYBIF+B2yCgJ nCS7JXf3xgn6s7ARLsf4rXxhaIBTqA2ZUkbOh2R63QiUs5tzXWMw5aN0IFTGacBOsmET 3PAUASUAw/SkLZ4N12nDj/523WuF/tFGSFdQk= Received: by 10.213.32.75 with SMTP id b11mr1884998ebd.30.1281600774791; Thu, 12 Aug 2010 01:12:54 -0700 (PDT) Received: from [0.0.0.0] (5357DA75.cable.casema.nl [83.87.218.117]) by mx.google.com with ESMTPS id a48sm1746140eei.0.2010.08.12.01.12.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 12 Aug 2010 01:12:53 -0700 (PDT) Message-ID: <4C63AD83.3060602@gmail.com> Date: Thu, 12 Aug 2010 10:14:59 +0200 From: Yeb Havinga User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Tom Lane CC: Mark Rostron , "pgsql-admin@postgresql.org" Subject: Re: how do i query the type of an object? References: <1823.1281577198@sss.pgh.pa.us> In-Reply-To: <1823.1281577198@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201008/92 X-Sequence-Number: 35341 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/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