Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id DC7E09FB6A3 for ; Wed, 1 Nov 2006 15:23:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 59550-01-4 for ; Wed, 1 Nov 2006 15:23:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id C72979FBBD9 for ; Wed, 1 Nov 2006 10:32:46 -0400 (AST) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1GfH8m-0007NV-Oa; Wed, 01 Nov 2006 09:32:28 -0500 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id BC7773FAF; Wed, 1 Nov 2006 09:32:35 -0500 (EST) Date: Wed, 1 Nov 2006 09:32:35 -0500 From: Andrew Sullivan To: Volkan YAZICI Cc: George Pavlov , Andrew Sullivan , pgsql-sql@postgresql.org Subject: Re: record datatype comparisons Message-ID: <20061101143235.GB25856@phlogiston.dyndns.org> References: <20061031212253.GD20809@phlogiston.dyndns.org> <8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net> <20061031214927.GF12008@alvh.no-ip.org> <20061031215808.GD1911@alamut> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061031215808.GD1911@alamut> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/6 X-Sequence-Number: 26658 On Tue, Oct 31, 2006 at 11:58:08PM +0200, Volkan YAZICI wrote: > On Oct 31 06:49, Alvaro Herrera wrote: > > > select > > > (select (1,2)) > > > is distinct from > > > (select (1,2)) > > > ; > > alvherre=# select > > row(1,2) > > is distinct from > > row(1,2) > > What's the difference between "SELECT (1, 2);" and "SELECT ROW(1, 2);"? It's not the difference between SELECT (1,2) and SELECT ROW(1,2) that's relevant, but the difference between SELECT (SELECT (1,2)) and SELECT ROW(1,2). The row's datatype(s) is(are) defined. The record's datatype isn't. So you can have an equality operator for the row. You can see this from the error message when you do this: testing=# SELECT ROW(1,2) is distinct from ROW ('a','b'); ERROR: invalid input syntax for integer: "a" This is part of the subtle difference between the record and row datatypes. A -- Andrew Sullivan | ajs@crankycanuck.ca The plural of anecdote is not data. --Roger Brinner