Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 74C0F9FB8A1 for ; Wed, 1 Nov 2006 15:03:01 -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 47192-07 for ; Wed, 1 Nov 2006 15:01:58 -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 96B659FBBC8 for ; Wed, 1 Nov 2006 10:28:40 -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 1GfH4s-0007LD-DD for pgsql-sql@postgresql.org; Wed, 01 Nov 2006 09:28:26 -0500 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 4F99D3FAF; Wed, 1 Nov 2006 09:28:33 -0500 (EST) Date: Wed, 1 Nov 2006 09:28:33 -0500 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: record datatype comparisons Message-ID: <20061101142833.GA25856@phlogiston.dyndns.org> References: <55c095e90610311135l101f6a91s433e6d7e5b90cb7c@mail.gmail.com> <8C5B026B51B6854CBE88121DBF097A8655CBDD@ehost010-33.exch010.intermedia.net> <20061031212253.GD20809@phlogiston.dyndns.org> <20061031214500.GC1911@alamut> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061031214500.GC1911@alamut> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/5 X-Sequence-Number: 26657 On Tue, Oct 31, 2006 at 11:45:00PM +0200, Volkan YAZICI wrote: > > > > Note the column headers. They're differently shaped. Because > > pseudotype record doesn't have a shape, equality doesn't make sense, > > so you need two shapes that are already identical, so they can use > > the matching rules for that. > > Can you be more verbose please? I couldn't understand what you mean with > "shape". It's an analogy, really. The datatype numeric() for instance, is determined. Because it's determined, you can have determinate rules for comparing one to another. But the pseudotype record doesn't work that way. It can accept whatever you put in there, which is why you can define a variable as type record, and then select from different tables (or even different datatypes!) to it in plpgsql: it accommodates these different things. The trade-off is that comparing a record to another record won't always work: because what a record is is not pre-determined, you can't have determinate rules for comparing one record to another. And without determinate rules, you can't have an equality operator. A -- Andrew Sullivan | ajs@crankycanuck.ca This work was visionary and imaginative, and goes to show that visionary and imaginative work need not end up well. --Dennis Ritchie