Re: BUG #19603: Vuln47: distance_taxicab and distance_chebyshev silently return 0 instead of NaN when a cube coordin

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, 1217816127(at)qq(dot)com
Subject: Re: BUG #19603: Vuln47: distance_taxicab and distance_chebyshev silently return 0 instead of NaN when a cube coordin
Date: 2026-11-06 09:00:14
Message-ID: CAJ7c6TNqfeQPHJO=gT6wP1QGvoP1nxtpq2EHx0rNU8d7Nm_4Jw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Ayush,

> Thanks, I've changed the test in v3. I just wanted not to overboard
> the test suite hence had left a few things out.
>
> v3 attached.

v3 is a significant improvement over v2. One thing that catches my eye:

```
@@ -1145,7 +1152,7 @@ SELECT cube_is_point('(0,1,2)'::cube);
t
(1 row)

-SELECT cube_is_point('(0,1,2),(0,1,2)'::cube);
+SELECT cube_is_point(cube(ARRAY['NaN'::float8], ARRAY['NaN'::float8]));
cube_is_point
---------------
t
@@ -1375,7 +1382,7 @@ SELECT cube_size('(4,8),(15,16)'::cube);
88
(1 row)

-SELECT cube_size('(42,137)'::cube);
+SELECT cube_size(cube_subset('(NaN,0),(NaN,1)'::cube, ARRAY[1]));
cube_size
-----------
0
```

The patch shouldn't remove any existing tests, only add new ones.

IMO two patches should be squashed into one. They are addressing
basically one issue. One patch would be much easier to test and
review. In particular, one shouldn't make sure that 0001 is a correct
patch without 0002 applied.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ayush Tiwari 2026-11-06 09:56:46 Re: BUG #19603: Vuln47: distance_taxicab and distance_chebyshev silently return 0 instead of NaN when a cube coordin
Previous Message Amit Langote 2026-11-06 08:34:26 Re: BUG #19768: JSON_TABLE: row/text comparisons in context item or PASSING give wrong results or spurious collation