BUG #18835: spgist index fails to accept point with NaN

Started by PG Bug reporting formabout 1 year ago2 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 18835
Logged by: Alexander Lakhin
Email address: exclusion@gmail.com
PostgreSQL version: 17.4
Operating system: Ubuntu 24.04
Description:

The following script:
CREATE TABLE t(p point);
INSERT INTO t SELECT point(g, g) FROM generate_series(1, 1000) g;
INSERT INTO t VALUES ('(0,NaN)'::point);

CREATE INDEX spgist_idx ON t USING spgist(p);
triggers:
ERROR: XX000: getQuadrant: impossible case
LOCATION: getQuadrant, spgquadtreeproc.c:77

Reproduced starting from 8daeb5ddd.

This anomaly is discovered with SQLsmith.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: BUG #18835: spgist index fails to accept point with NaN

PG Bug reporting form <noreply@postgresql.org> writes:

The following script:
CREATE TABLE t(p point);
INSERT INTO t SELECT point(g, g) FROM generate_series(1, 1000) g;
INSERT INTO t VALUES ('(0,NaN)'::point);

CREATE INDEX spgist_idx ON t USING spgist(p);
triggers:
ERROR: XX000: getQuadrant: impossible case

Yeah. There's been some past attempts to clean up our behavior
for NaNs in geometric values, but it's such a mess that not
much progress has been made. So I can't get excited about
worrying about this case in particular (especially since I don't
see any easy fix). I wonder if we shouldn't just ban NaNs in
the geometric types.

regards, tom lane