Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cev5g-0002Ob-My for pgsql-bugs@arkaria.postgresql.org; Sat, 18 Feb 2017 02:49:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cev5g-0008Mj-5c for pgsql-bugs@arkaria.postgresql.org; Sat, 18 Feb 2017 02:49:40 +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 1ceuty-0007dK-A2 for pgsql-bugs@postgresql.org; Sat, 18 Feb 2017 02:37:34 +0000 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ceutv-0004GB-8O for pgsql-bugs@postgresql.org; Sat, 18 Feb 2017 02:37:33 +0000 Received: by mail-qk0-x236.google.com with SMTP id u25so59589703qki.2 for ; Fri, 17 Feb 2017 18:37:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:thread-index :content-language; bh=IJa0isP6miXxrkyVpR4rOo12e5eHCJrkJxWyizhambk=; b=lU/a4PyiDIzDeCOz8UzWz5Hz6sfeDji/XYdzne16yOpbKPd1u0erOyEEGGJ2mTCsiL I3T5DvOcJvhC8qLQPjFKGjqj4GUEEeUD7l766Zv+v1mAvyJ4rbTc87WOv3W6hbPNXB2E qo2cIqOE+2Itc9uwdLbFb95Xy7njnWap1DY4Bfld3W6no8rghAn6WxfYwYcDeUSFdAw3 5yhOF0txFkEvkyayzN6jMrAfDp61V0slgMna/rr04QUtAVGks7B4wNYwOiYAQA1MDKDF RVsA6XRlNfNPYv2wZlVMrSZ0wj02Hv5+TUEPL8oQCWIwD7kqD73MnTFch3J8XLcU9sOd qPRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:references:in-reply-to:subject:date :message-id:mime-version:content-transfer-encoding:thread-index :content-language; bh=IJa0isP6miXxrkyVpR4rOo12e5eHCJrkJxWyizhambk=; b=sKhqt75eoCsAbZjzkL9CwHW3VWR9GzY+gIlqMDinv3ecA+3HO0PTAgM9yzE4bkIrqU 3WyRFmpG6t+5IpImuE2frjuhYBpHro+xlpNmdhT51oK4iw/FWB3kBAN4BwfcIX8Hd4S9 kZiWymc5HQq6UPstkhyCEzR1ejL2gAAAW7L5wBXrttz4yFXo9ImstbpoHRRM3f1+jC1m RPzAk83wG4gO+RVkWhA1iItcHN8fYepRVSootQ5evKlyYOwgWInvM3nqrCiDJ2EwtzWj YbkKVa856c5JUBWauousY/7cg7IQhRAjMZlV+SUaSl81y+0Lo7gRje9zD0+LDjTljxU5 VbcA== X-Gm-Message-State: AMke39lN/pBe/sSJTXAwtx+orD8ZII9BvVo68ponfA7/jLfVT1qcILfWaIEB5ZTwY6050g== X-Received: by 10.55.88.66 with SMTP id m63mr11080354qkb.270.1487385449715; Fri, 17 Feb 2017 18:37:29 -0800 (PST) Received: from VSHUALU001 ([198.211.96.64]) by smtp.gmail.com with ESMTPSA id x5sm6210599qka.40.2017.02.17.18.37.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Feb 2017 18:37:29 -0800 (PST) From: "Casey Witt" To: , "'Tom Lane'" Cc: "'PostgreSQL Bugs'" References: <20170215091408.6099.42167@wrigleys.postgresql.org> <19360.1487183340@sss.pgh.pa.us> In-Reply-To: Subject: Re: BUG #14546: "point" type does not work with "IS DISTINCT" Date: Sat, 18 Feb 2017 10:37:23 +0800 Message-ID: <004901d2898f$f273f520$d75bdf60$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGDcJXB5Y/vYlmMDbyQHKoZQzB6dgJG4gXbAkWJ9u2h59NMgA== Content-Language: en-us X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Emre, Yeah, changing existing Macros is tough, because it can break backwards com= patibility. I had in mind that fixing this for a point would be easy since the "=3D" an= d btree operators are not defined, no existing code bases would be impacted= by implementing them, but when I re-read Tom Lanes email I noticed the lin= e that says: "The same problems exist for other geometric types, usually worse, because= many of the others do have "=3D" operators but they compare areas :-(. I feel like it is tragic that "=3D" got implemented for geometric types in = PostgreSQL using area, because my gut sense is that equality in PostgreSQL = should be based on the raw values stored, and not some arbitrary transforma= tion of them. In this case I am specifically making a distinction between h= ow PostgreSQL should deal with points (and other geometric types) vs. how o= ther things (ie. PostGIS) should deal with them. If PostgreSQL can deal wit= h geometry simply and deterministically (ie. "=3D" means the raw values are= equal, and ordering is based on the cheapest determistic function availabl= e), then that would provide a good foundation for everything else (ie. Post= GIS) to define whatever makes sense in that environment based on the fundam= ental definition in PostgreSQL. I don't really even like the fact that "~=3D" is defined for points for thr= ee reasons: 1) it is fuzzy, but no way to control the error. If you think of "~=3D" as = being the same as "close to", coordinates on in IC chip will want to consid= er "close to" in the nanometer range, whereas coordinates for a house will = consider "close to" in the meter range (if anybody disagrees that coordinat= es for a house would be in the meter range, that demonstrates the point tha= t the definition of "close to" should not be baked into PostgreSQL because = it is use case specific). Although PostgreSQL doesn't innately understand t= he difference between nanometers and meters, the point is for the IC chip c= ase you may be comparing at the 6th decimal place, whereas for the house ca= se you may want to compare at the first decimal place. 2) there is no expectation that "~=3D" is defined for every type (unlike "= =3D", which is documented (incorrectly) to be defined for every type) 3) "~=3D" could be handled by a function which takes two points and an erro= r value (thus allowing the user to use the error value suitable for their u= se case) The idea here being that PostgreSQL doesn't even know what it is storing or= in what context it is being used (as far as PostgreSQL is concerned, it is= just storing bytes that fit the format of some defined type), so it should= n't be making assumptions about what "close" means. Whereas PostGIS does kn= ow what it is storing and in what context it is being used, so PostGIS can = make assumptions about what is close (but note that I have never actually u= sed PostGIS, so this is just an assumption). I am NOT suggesting any change to "~=3D" because that clearly would break b= ackward compatibility, but I can't help feeling that PostgreSQL is building= a pretty big "technical debt" by not sorting this out sooner rather than l= ater. Casey -----Original Message----- From: Emre Hasegeli [mailto:emre@hasegeli.com]=20 Sent: Friday, February 17, 2017 17:21 To: Tom Lane Cc: kcwitt@gmail.com; PostgreSQL Bugs Subject: Re: [BUGS] BUG #14546: "point" type does not work with "IS DISTINC= T" > Nobody's really wanted to break backwards compatibility enough to=20 > bring some sanity to that mess. I am trying to bring some sanity to that mess: https://www.postgresql.org/message-id/flat/CAE2gYzwwxPWbzxY3mtN4WL7W0DCkWo8= gnB2ThUHU2XQ9XwgHMg%40mail.gmail.com Any comment helps to keep the discussion moving. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs