Re: SLOPE - Planner optimizations on monotonic expressions. - Mailing list pgsql-hackers

From Zsolt Parragi
Subject Re: SLOPE - Planner optimizations on monotonic expressions.
Date
Msg-id CAN4CZFPhBcNP6jxA4u=V=mie=DNyYe4t8cENCzXk49ojkZ=5JQ@mail.gmail.com
Whole thread
In response to Re: SLOPE - Planner optimizations on monotonic expressions.  (Alexandre Felipe <o.alexandre.felipe@gmail.com>)
Responses Re: SLOPE - Planner optimizations on monotonic expressions.
List pgsql-hackers
Apologies for the late response, somehow I missed this update.

The changes generally look good and seem to work, except one remaining
issue with domains:

CREATE DOMAIN df AS float8;
CREATE TABLE t (id int, x df);
INSERT INTO t VALUES (1,'-inf'),(2,'-1'),(3,'0'),(4,'3'),(5,'inf'),(6,'nan');
CREATE INDEX ON t (x);
SET enable_seqscan=off; SET enable_sort=off; SET enable_bitmapscan=off;
SELECT id, -x AS f FROM t  ORDER BY (-x) ASC NULLS FIRST;



 /*
  * get_const_sign
  *        Helper to determine the sign of a numeric constant.
  *        Returns 1 for positive, -1 for negative, 0 for zero or unknown.
  */
-static int
+static inline enum NUMERIC_SIGN

This comment is now outdated. The default value is unreachable
currently, but is 0 still a safe value there?


+enum NUMERIC_SIGN {
+    NUMERIC_SIGN_NINF=-2,
+    NUMERIC_SIGN_NEG=-1,
+    NUMERIC_SIGN_ZERO=0,
+    NUMERIC_SIGN_POS=1,
+    NUMERIC_SIGN_PINF=3,
+    NUMERIC_SIGN_NAN=4,
+    NUMERIC_SIGN_NULL=5,
+};

this is missing a typedef and maybe it should be defined at the
beginning of the file or in a header? Is skipping positive 2
intentional?

The patchset also has many small formatting issues/inconsistencies,
maybe it would be worth to run pgindent on it?



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: POC: PLpgSQL FOREACH IN JSON ARRAY
Next
From: Zsolt Parragi
Date:
Subject: Re: proposal - queryid can be used as filter for auto_explain