Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5wwW-0004Ue-Vb for pgsql-hackers@arkaria.postgresql.org; Thu, 26 May 2016 15:11:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b5wwW-0002Gg-Gu for pgsql-hackers@arkaria.postgresql.org; Thu, 26 May 2016 15:11:24 +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 1b5wwV-0002GK-Ij for pgsql-hackers@postgresql.org; Thu, 26 May 2016 15:11:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b5wwR-0005oL-V7 for pgsql-hackers@postgresql.org; Thu, 26 May 2016 15:11:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u4QFBBrH005834; Thu, 26 May 2016 11:11:11 -0400 From: Tom Lane To: Andreas Seltenreich cc: Peter Geoghegan , Andres Freund , Pg Hackers Subject: Re: ORDER/GROUP BY expression not found in targetlist In-reply-to: <87zircga6w.fsf@credativ.de> References: <20160526021235.w4nq7k3gnheg7vit@alap3.anarazel.de> <87a8jcoqtc.fsf@elite.ansel.ydns.eu> <26822.1464271975@sss.pgh.pa.us> <87zircga6w.fsf@credativ.de> Comments: In-reply-to Andreas Seltenreich message dated "Thu, 26 May 2016 16:34:15 +0200" Date: Thu, 26 May 2016 11:11:11 -0400 Message-ID: <5833.1464275471@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) 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 Andreas Seltenreich writes: > Tom Lane writes: >> It's looking for an operator that is known to be semantically equality, >> by virtue of being the equality member of a btree or hash opclass. >> Type path has no such opclass unfortunately. > As do lots of data types in the regression db while still having an > operator providing semantic equivalence. I was hoping for someone to > question that status quo. Naively I'd say an equivalence flag is > missing in the catalog that is independent of opclasses. [ shrug... ] I see little wrong with that status quo. For this particular use-case, there are two ways we could implement DISTINCT: one of them requires sorting, and the other requires hashing. So you would need to provide that opclass infrastructure even if there were some other way of identifying the operator that means equality. Type path and the other geometric types lack any natural sort order so it's hard to imagine making a default btree opclass for them. But a default hash opclass might not be out of reach, given an exact equality operator. Another problem with the geometric types is that long ago somebody invented "=" operators for most of them that have little to do with what anyone would consider equality. The "path = path" operator just compares whether the paths have the same number of points. A lot of the other ones compare areas. It'd be hard to justify marking any of them as default equality for the type. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers