Re: SLOPE - Planner optimizations on monotonic expressions.

Zsolt Parragi <zsolt.parragi@percona.com>

From: Zsolt Parragi <zsolt.parragi@percona.com>
To: Alexandre Felipe <o.alexandre.felipe@gmail.com>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>, Corey Huinker <corey.huinker@gmail.com>, pgsql-hackers@postgresql.org
Date: 2026-05-08T22:18:55Z
Lists: pgsql-hackers
> There were too many possibilities for my brain to enumerate, so I scripted
> the
> extraction and presentation of that in regress/sql/slope.sql in commit 0005.

Apologies, I forgot to reply to this earlier, the new NULL handling
looks good. Nice test!

I found one more corner case with infinities (same applies also with
negative infinity):

CREATE TABLE t8 (x float8);
INSERT INTO t8 VALUES (-2), (-1), (0), (1), (2);
CREATE INDEX t8_x_idx ON t8 (x);
ANALYZE t8;

SET enable_seqscan = off;
SELECT x, x * 'Infinity'::float8 AS f FROM t8 ORDER BY x * 'Infinity'::float8;

SET enable_indexscan = off;
SET enable_indexonlyscan = off;
SET enable_seqscan = on;
SELECT x, x * 'Infinity'::float8 AS f FROM t8 ORDER BY x * 'Infinity'::float8;