| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Cc: | 2530254482(at)qq(dot)com |
| Subject: | BUG #19401: Inconsistent predicate evaluation with derived table vs direct query involving NULL |
| Date: | 2026-02-11 15:57:15 |
| Message-ID: | 19401-c9040563b011f44b@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 19401
Logged by: Ce Lyu
Email address: 2530254482(at)qq(dot)com
PostgreSQL version: 18.1
Operating system: Ubuntu
Description:
Dear PostgreSQL developers,
I would like to report a behavior that appears to be incorrect and
inconsistent in PostgreSQL when the same predicate is evaluated in (1) a
derived table and (2) a direct query.
The two queries are logically equivalent, but they return different
cardinalities.
Environment
PostgreSQL version:
PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by
gcc (Debian 14.2.0-19) 14.2.0, 64-bit
Minimal Reproduction
CREATE TABLE t0 (c0 TEXT);
INSERT INTO t0 (c0) VALUES ('4');
-- result: length 0;
SELECT ref0 FROM (SELECT (any_value(c0)) AS ref0, ((('j' = NULL) <= (NULL =
NULL))) AS ref1 FROM t0) AS s WHERE ref1;
-- result: length 1; (NULL)
SELECT (any_value(c0)) FROM t0 WHERE (('j' = NULL) <= (NULL = NULL));
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-02-11 16:43:41 | Re: BUG #19401: Inconsistent predicate evaluation with derived table vs direct query involving NULL |
| Previous Message | Raphaël Perissat | 2026-02-11 09:56:53 | Re: BUG #19400: Memory leak in checkpointer and startup processes on PostgreSQL 18 |