Re: Issue with point_ops and NaN

2021-04-03 Thread Julien Rouhaud
Le jeu. 1 avr. 2021 à 15:54, Laurenz Albe a écrit : > On Thu, 2021-04-01 at 09:35 +0900, Kyotaro Horiguchi wrote: > > > > > > > > > SELECT point('NaN','NaN') <@ > polygon('(0,0),(1,0),(1,1),(0,0)'); > > > > > > > > > ?column? > > > > > > > > > -- > > > > > > > > >t > > > > > > > > >

Re: Issue with point_ops and NaN

2021-04-01 Thread Laurenz Albe
On Thu, 2021-04-01 at 09:35 +0900, Kyotaro Horiguchi wrote: > > > > > > > > SELECT point('NaN','NaN') <@ polygon('(0,0),(1,0),(1,1),(0,0)'); > > > > > > > > ?column? > > > > > > > > -- > > > > > > > >t > > > > > > > >(1 row) > > > > If you think of "NaN" literally as "not a number

Re: Issue with point_ops and NaN

2021-03-31 Thread Kyotaro Horiguchi
At Thu, 01 Apr 2021 09:34:40 +0900 (JST), Kyotaro Horiguchi wrote in > I have to change almost all boolean-returning functions to > tri-state-boolean ones. I'll give it try a bit futther. The attached is a rush work of that, on top of the (rebased version of the) base patch. Disregarding its u

Re: Issue with point_ops and NaN

2021-03-31 Thread Kyotaro Horiguchi
At Wed, 31 Mar 2021 12:01:08 +0200, Laurenz Albe wrote in > On Wed, 2021-03-31 at 15:48 +0900, Kyotaro Horiguchi wrote: > > > > > > > SELECT point('NaN','NaN') <@ polygon('(0,0),(1,0),(1,1),(0,0)'); > > > > > > > ?column? > > > > > > > -- > > > > > > > t > > > > > > > (1 row) > > >

Re: Issue with point_ops and NaN

2021-03-31 Thread Kyotaro Horiguchi
At Wed, 31 Mar 2021 16:30:41 +0800, Julien Rouhaud wrote in > On Wed, Mar 31, 2021 at 03:48:16PM +0900, Kyotaro Horiguchi wrote: > > > > Thanks! However, Michael's suggestion is worth considering. What do > > you think about makeing NaN-involved comparison return NULL? If you > > agree to tha

Re: Issue with point_ops and NaN

2021-03-31 Thread Laurenz Albe
On Wed, 2021-03-31 at 15:48 +0900, Kyotaro Horiguchi wrote: > > > > > > SELECT point('NaN','NaN') <@ polygon('(0,0),(1,0),(1,1),(0,0)'); > > > > > > ?column? > > > > > > -- > > > > > > t > > > > > > (1 row) > > > > > > > > Agreed --- one could make an argument for either 'false' or NU

Re: Issue with point_ops and NaN

2021-03-31 Thread Julien Rouhaud
On Wed, Mar 31, 2021 at 03:48:16PM +0900, Kyotaro Horiguchi wrote: > > Thanks! However, Michael's suggestion is worth considering. What do > you think about makeing NaN-involved comparison return NULL? If you > agree to that, I'll make a further change to the patch. As I mentioned in [1] I thin

Re: Issue with point_ops and NaN

2021-03-31 Thread Kyotaro Horiguchi
At Wed, 31 Mar 2021 15:46:16 +0900 (JST), Kyotaro Horiguchi wrote in > At Wed, 31 Mar 2021 09:26:00 +0900, Michael Paquier > wrote in > > On Tue, Mar 30, 2021 at 11:39:40PM +0800, Julien Rouhaud wrote: > > > On Tue, Mar 30, 2021 at 11:02:32AM -0400, Tom Lane wrote: > > >> Agreed --- one could

Re: Issue with point_ops and NaN

2021-03-30 Thread Kyotaro Horiguchi
At Wed, 31 Mar 2021 12:04:26 +0800, Julien Rouhaud wrote in > On Tue, Mar 30, 2021 at 11:39:40PM +0800, Julien Rouhaud wrote: > > On Tue, Mar 30, 2021 at 11:02:32AM -0400, Tom Lane wrote: > > > Julien Rouhaud writes: > > > > On Tue, Mar 30, 2021 at 02:47:05PM +0200, Laurenz Albe wrote: > > > >>

Re: Issue with point_ops and NaN

2021-03-30 Thread Kyotaro Horiguchi
At Wed, 31 Mar 2021 09:26:00 +0900, Michael Paquier wrote in > On Tue, Mar 30, 2021 at 11:39:40PM +0800, Julien Rouhaud wrote: > > On Tue, Mar 30, 2021 at 11:02:32AM -0400, Tom Lane wrote: > >> Agreed --- one could make an argument for either 'false' or NULL > >> result, but surely not 'true'. >

Re: Issue with point_ops and NaN

2021-03-30 Thread Julien Rouhaud
On Tue, Mar 30, 2021 at 11:39:40PM +0800, Julien Rouhaud wrote: > On Tue, Mar 30, 2021 at 11:02:32AM -0400, Tom Lane wrote: > > Julien Rouhaud writes: > > > On Tue, Mar 30, 2021 at 02:47:05PM +0200, Laurenz Albe wrote: > > >> I'd say that this is certainly wrong: > > >> SELECT point('NaN','NaN') <

Re: Issue with point_ops and NaN

2021-03-30 Thread Michael Paquier
On Tue, Mar 30, 2021 at 11:39:40PM +0800, Julien Rouhaud wrote: > On Tue, Mar 30, 2021 at 11:02:32AM -0400, Tom Lane wrote: >> Agreed --- one could make an argument for either 'false' or NULL >> result, but surely not 'true'. > > I would think that it should return NULL since it's not inside nor o

Re: Issue with point_ops and NaN

2021-03-30 Thread Julien Rouhaud
On Tue, Mar 30, 2021 at 11:02:32AM -0400, Tom Lane wrote: > Julien Rouhaud writes: > > On Tue, Mar 30, 2021 at 02:47:05PM +0200, Laurenz Albe wrote: > >> I'd say that this is certainly wrong: > >> SELECT point('NaN','NaN') <@ polygon('(0,0),(1,0),(1,1),(0,0)'); > >> > >> ?column? > >> --

Re: Issue with point_ops and NaN

2021-03-30 Thread Tom Lane
Julien Rouhaud writes: > On Tue, Mar 30, 2021 at 02:47:05PM +0200, Laurenz Albe wrote: >> I'd say that this is certainly wrong: >> SELECT point('NaN','NaN') <@ polygon('(0,0),(1,0),(1,1),(0,0)'); >> >> ?column? >> -- >> t >> (1 row) > Yeah that's what I think too, but I wanted to have

Re: Issue with point_ops and NaN

2021-03-30 Thread Julien Rouhaud
On Tue, Mar 30, 2021 at 02:47:05PM +0200, Laurenz Albe wrote: > On Tue, 2021-03-30 at 17:57 +0800, Julien Rouhaud wrote: > > > > Getting a consistent behavior shouldn't be hard, but I'm unsure which > > behavior > > is actually correct. > > I'd say that this is certainly wrong: > > SELECT point

Re: Issue with point_ops and NaN

2021-03-30 Thread Laurenz Albe
On Tue, 2021-03-30 at 17:57 +0800, Julien Rouhaud wrote: > While running some sanity checks on the regression tests, I found one test > that > returns different results depending on whether an index or a sequential scan > is > used. > > Minimal reproducer: > > =# CREATE TABLE point_tbl AS selec

Issue with point_ops and NaN

2021-03-30 Thread Julien Rouhaud
Hi, While running some sanity checks on the regression tests, I found one test that returns different results depending on whether an index or a sequential scan is used. Minimal reproducer: =# CREATE TABLE point_tbl AS select '(nan,nan)'::point f1; =# CREATE INDEX ON point_tbl USING gist(f1); =