Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbbeO-0003gv-HM for pgsql-hackers@arkaria.postgresql.org; Sun, 30 Jul 2017 00:00:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dbbeN-0008AS-Mt for pgsql-hackers@arkaria.postgresql.org; Sun, 30 Jul 2017 00:00:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dbbeL-0008A0-Qu for pgsql-hackers@postgresql.org; Sun, 30 Jul 2017 00:00:02 +0000 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dbbeI-0005Sb-MZ for pgsql-hackers@postgresql.org; Sun, 30 Jul 2017 00:00:00 +0000 Received: by mail-qk0-x231.google.com with SMTP id z18so53066111qka.4 for ; Sat, 29 Jul 2017 16:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=wFxlDUbN6NjTxxWp/G6pGRrIN5Bw2n8wUaeYSW+NIck=; b=eEiP7Y6sOmscBiEmySd7E9SahXp74AJnvuMYoRK4Lpto+aDWGd7AvZETpU0TclgPQB kueus2Hr5dVNsiAngoUzCCg2vUZLobDQbiJNpyo2Q6Y7r9m7uQ5vBmim2v2A/BObC1XZ SvobO+RRDq2mVA6Nlf6WpovsX/CcBVhThe7ZxEPz8tvIiprwN+6w2L080WKf/7I+7Azs DgGXO2rOm18eqPycTCC2yMf4yzO+sI65Fak9+Hf/KOB76jzwYetD27LP8y21xcXWUFyZ f5FsQNdvw1V6NIoacq/PqvaRnJF16+uprmQnRhRReTIeIsPq/fgsQ/PK5TueNiBb+rCK wFlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=wFxlDUbN6NjTxxWp/G6pGRrIN5Bw2n8wUaeYSW+NIck=; b=FquvLd65YWvcvqWvLUBUVWfxON9/GX+IIZrmCyH4opGJao/5HPlnfLPZTLRAB5yC/d l40amVHVVvNwmEdRBluX5qHl64k+NYSCi3Ux+oUf+ABMpN4yREICyDiaFeWVZoVIJ1aH JO0/04DXitext1OgBg8gWmZoML90pv/63quFJNwlST+0+ehi4X2CGO/OUIb5R5S9ps4B rVM8Ycqzj2GokStuGG6JbmnGdzGDCeKKCDLsEg+7bqXisiHIrMQ7njgapXQB6ytlUvLV 01ur4aSbfh9nEkyjPZg30vUcLRdPE6b7kFt40/3bTYhOihk4azypK6/XsWg3gfW3YEoU m/Ag== X-Gm-Message-State: AIVw112cCplCk8hGqLp9wcfclejG4y9CU/+lqedRRpU9GvDWlDZVwrHT BQVF9vVwkMSEUiHz X-Received: by 10.55.118.66 with SMTP id r63mr15097673qkc.234.1501372797429; Sat, 29 Jul 2017 16:59:57 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([190.217.211.14]) by smtp.gmail.com with ESMTPSA id s51sm5245299qtc.9.2017.07.29.16.59.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 29 Jul 2017 16:59:56 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id CCA89570; Sat, 29 Jul 2017 19:59:43 -0400 (-04) Date: Sat, 29 Jul 2017 19:59:43 -0400 From: Alvaro Herrera To: Mark Rofail Cc: pgsql-hackers , Robert Haas , Alexander Korotkov , David Steele , Stephen Frost , pgsql-hackers-owner@postgresql.org, Erik Rijkers Subject: Re: GSoC 2017: Foreign Key Arrays Message-ID: <20170729235943.ev5z6jgav67f4mf6@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Mark Rofail wrote: > These are limitations of the patch ordered by importance: > > ✗ presupposes that count(distinct y) has exactly the same notion of > equality that the PK unique index has. In reality, count(distinct) will > fall back to the default btree opclass for the array element type. Operators are classified in operator classes; each data type may have more than one operator class for a particular access method. Exactly one operator class for some access method can be designated as the default one for a type. However, when you create an index, you can indicate which operator class to use, and it may not be the default one. If a different one is chosen at index creation time, then a query using COUNT(distinct) will do the wrong thing, because DISTINCT will select an equality type using the type's default operator class, not the equality that belongs to the operator class used to create the index. That's wrong: DISTINCT should use the equality operator that corresponds to the index' operator class instead, not the default one. I hope that made sense. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers