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

The Post Office <noreply@postgresql.org>

From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Date: 2025-03-07T18:00:01Z
Lists: pgsql-bugs
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.