Re: Self contradictory examining on rel's baserestrictinfo - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Self contradictory examining on rel's baserestrictinfo
Date
Msg-id 1686217.1732641235@sss.pgh.pa.us
Whole thread Raw
In response to Re: Self contradictory examining on rel's baserestrictinfo  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Self contradictory examining on rel's baserestrictinfo
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Nov 25, 2024 at 4:39 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> ...  I think Robert
>> must have had constraint_exclusion = on for his examples a
>> couple messages back.)

> I definitely didn't change the value of that setting. It's possible I
> was running on an older branch, but I don't think it was anything
> ancient.

Hmm, constraint_exclusion has defaulted to "partition" for many
years now.  But when I tried to reproduce your examples at [1]:

regression=# create table foo (a int);
CREATE TABLE
regression=# explain select * from foo where a < 1 and a > 1;
                     QUERY PLAN
-----------------------------------------------------
 Seq Scan on foo  (cost=0.00..48.25 rows=13 width=4)
   Filter: ((a < 1) AND (a > 1))
(2 rows)

regression=# show constraint_exclusion;
 constraint_exclusion
----------------------
 partition
(1 row)

regression=# set constraint_exclusion = on;
SET
regression=# explain select * from foo where a < 1 and a > 1;
                QUERY PLAN
------------------------------------------
 Result  (cost=0.00..0.00 rows=0 width=0)
   One-Time Filter: false
(2 rows)

and similarly for some of the other examples (I didn't try
every one).  Maybe your test table was partitioned??

            regards, tom lane

[1] https://www.postgresql.org/message-id/CA%2BTgmoZqiCwHbZczXXLjucfuHi%3D7EahSyzEj5yrqYKMQ0QOL9Q%40mail.gmail.com



pgsql-hackers by date:

Previous
From: Kirill Reshke
Date:
Subject: Re: Allow non-superuser to cancel superuser tasks.
Next
From: Peter Eisentraut
Date:
Subject: Re: doc: pgevent.dll location