Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 08168C955BC for ; Mon, 4 Jun 2012 18:31:24 -0300 (ADT) Received: from mail-bk0-f46.google.com ([209.85.214.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sberw-00076H-PP for pgsql-bugs@postgresql.org; Mon, 04 Jun 2012 21:31:23 +0000 Received: by bkcji2 with SMTP id ji2so4031466bkc.19 for ; Mon, 04 Jun 2012 14:31:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding :x-gm-message-state; bh=7tAnm5yNnm/3j5vYQg10czTlLAFUx35SOUiLo+BP6dI=; b=kR5LwUI3cILdrUqL5BuE+q09uZQ/fbtd9Rcl1fl6VydD3xc7dAp+NjRIkUySAOPtRQ wHdfuQUHOdhERrewH889OX8ELhGzdLEW/9Lc6tuhqY5th5xUCbHyHpiis6Z8qptBiLoR gwBxj4zjMp2OcpZRviP4xwGdujlMZdq8BRcCrwzP3UKf+ZOx3HVibawK6YXpCs8RcJh9 nz4QESrpl9nufySvTpBCHi7ecRoiRGR0r2CWmkXnFotx2PZE35Gjq2+kcuNCxh97Rnc1 3yPyz/oiHYDbGXe6ILOgl/lpRFSf6vJ12xkgri78gbV04iCi7przW7oAaVjKV7PsCRvl bUgw== Received: by 10.204.132.87 with SMTP id a23mr7276805bkt.134.1338845467487; Mon, 04 Jun 2012 14:31:07 -0700 (PDT) Received: from ?IPv6:::1? (li224-40.members.linode.com. [173.255.214.40]) by mx.google.com with ESMTPS id o4sm11822321bkv.15.2012.06.04.14.31.03 (version=SSLv3 cipher=OTHER); Mon, 04 Jun 2012 14:31:06 -0700 (PDT) Subject: Re: BUG #6669: unique index w/ multiple columns and NULLs From: Jeff Davis To: Bruce Momjian Cc: Kevin Grittner , jo , pgsql-bugs@postgresql.org, Tom Lane In-Reply-To: <20120604155623.GD2352@momjian.us> References: <2870.1338521291@sss.pgh.pa.us> <4FC86818.4080002@sferacarta.com> <20120604150552.GB2352@momjian.us> <4FCC8E020200002500048003@gw.wicourts.gov> <20120604155623.GD2352@momjian.us> Content-Type: text/plain; charset="ISO-8859-1" Date: Mon, 04 Jun 2012 14:31:01 -0700 Message-ID: <1338845461.27297.21.camel@sussancws0025> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmGCLh17sbxTvkp/LlJVoKiKqOwfTjPxbnmBMjDEB3EIKnIOEy1ZDHmivDfbF5Gpp3CC4fb X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201206/28 X-Sequence-Number: 33255 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