Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 06A9298F703 for ; Tue, 5 Jun 2012 04:16:54 -0300 (ADT) Received: from mr002msr.fastwebnet.it ([85.18.95.65]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sbo0Z-0000Cv-Ab for pgsql-bugs@postgresql.org; Tue, 05 Jun 2012 07:16:53 +0000 Received: from [10.146.56.169] (10.146.56.169) by mr002msr.fastwebnet.it (8.5.140.03) id 4FBF8C2E00D9BE6F; Tue, 5 Jun 2012 09:16:21 +0200 Message-ID: <4FCDB246.6080001@sferacarta.com> Date: Tue, 05 Jun 2012 09:16:22 +0200 From: jo User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Jeff Davis CC: Bruce Momjian , Kevin Grittner , pgsql-bugs@postgresql.org, Tom Lane Subject: Re: BUG #6669: unique index w/ multiple columns and NULLs References: <2870.1338521291@sss.pgh.pa.us> <4FC86818.4080002@sferacarta.com> <20120604150552.GB2352@momjian.us> <4FCC8E020200002500048003@gw.wicourts.gov> <20120604155623.GD2352@momjian.us> <1338845461.27297.21.camel@sussancws0025> In-Reply-To: <1338845461.27297.21.camel@sussancws0025> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/35 X-Sequence-Number: 33262 Jeff Davis wrote: > On Mon, 2012-06-04 at 11:56 -0400, Bruce Momjian wrote: > >> I get your point about COUNT(*) really counting rows, not values, but >> why doesn't GROUP BY then skip nulls? >> > > A while ago, I came to the conclusion that applying logic to extrapolate > the behavior of NULL is a bad idea: > > http://thoughts.davisjeff.com/2009/08/02/what-is-the-deal-with-nulls/ > > Jose was not wrong about the inconsistency between UNIQUE and GROUP BY. > But the answer is that "we do it that way because the standard says so". > And that's a good reason. > > Regards, > Jeff Davis > > > The article pointed by Jeff is very insightful. NULLs, if you know them, avoid them :-( I agree with Date and Darwen about NULLs: "Chris Date and Hugh Darwen the authors of The Third Manifesto, have suggested that the SQL Null implementation is inherently flawed and should be ELIMINATED altogether^ , pointing to inconsistencies and flaws in the implementation of SQL Null-handling (particularly in aggregate functions) as proof that the entire concept of Null is flawed and should be removed from the relational model" j