Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id CEC5B43CEB8 for ; Thu, 19 Jan 2012 06:25:57 -0400 (AST) Received: from exprod7og117.obsmtp.com ([64.18.2.6]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RnpBp-0003Cu-Vi for pgsql-bugs@postgresql.org; Thu, 19 Jan 2012 10:25:58 +0000 Received: from mail-ey0-f170.google.com ([209.85.215.170]) (using TLSv1) by exprod7ob117.postini.com ([64.18.6.12]) with SMTP ID DSNKTxfvpMhdamdASKSSr72WTUn+MkLtcdZE@postini.com; Thu, 19 Jan 2012 02:25:53 PST Received: by eabm6 with SMTP id m6so1308677eab.29 for ; Thu, 19 Jan 2012 02:25:39 -0800 (PST) Received: by 10.213.10.134 with SMTP id p6mr6612885ebp.48.1326968739001; Thu, 19 Jan 2012 02:25:39 -0800 (PST) Received: from [192.168.1.101] (dsl-hkibrasgw2-ff6cc300-200.dhcp.inet.fi. [88.195.108.200]) by mx.google.com with ESMTPS id r2sm111633429eef.7.2012.01.19.02.25.37 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jan 2012 02:25:38 -0800 (PST) Message-ID: <4F17EFA0.6050903@enterprisedb.com> Date: Thu, 19 Jan 2012 12:25:36 +0200 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120104 Icedove/8.0 MIME-Version: 1.0 To: kenaniah@gmail.com CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6401: IS DISTINCT FROM improperly compares geomoetric datatypes References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201201/135 X-Sequence-Number: 32202 On 18.01.2012 23:14, kenaniah@gmail.com wrote: > The following bug has been logged on the website: > > Bug reference: 6401 > Logged by: Kenaniah Cerny > Email address: kenaniah@gmail.com > PostgreSQL version: 9.1.2 > Operating system: Centos 6 x86_64 > Description: > > ---- > SELECT point(2, 3) IS DISTINCT FROM point(2, 3); > ---- > ERROR: operator does not exist: point = point > LINE 1: SELECT point(2, 3) IS DISTINCT FROM point(2, 3) > ^ > HINT: No operator matches the given name and argument type(s). You might > need to add explicit type casts. > ---- > > According to the docs > (http://www.postgresql.org/docs/current/static/functions-geometry.html#FUNCTIONS-GEOMETRY), > the "same as" operator is the ~= operator, not the = operator. Yeah, unfortunately the code to transform IS DISTINCT FROM into the corresponding operator doesn't know about that. In fact, you might expect it to complain about missing "<>" operator, as "IS DISTINCT FROM" is really more like inequality, but the planner in fact implements it using the = operator, negating the result. That's because it's more common for datatypes to have a = operator than <>. Curiously, that's not the case with point datatype - it has a <> operator but not =. Frankly that's such a rare corner case that I'm not very enthusiastic about fixing it. One idea would be to look up the type's b-tree sort operators, and pick the equality operator from there. But point datatype doesn't have b-tree sort operators, either, so it wouldn't help in this case. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com