The following bug has been logged on the website:
Bug reference: 17978
Logged by: Zuming Jiang
Email address: zuming.jiang@inf.ethz.ch
PostgreSQL version: 16beta1
Operating system: Ubuntu 20.04
Description:
My fuzzer finds a bug in Postgres, which triggers an unexpected error in
Postgres.
--- Set up database ---
CREATE TABLE t0 (vkey integer, c1 timestamp);
CREATE TABLE t1 (vkey integer, pkey integer);
CREATE TABLE t2 (c11 timestamp, c14 timestamp);
CREATE VIEW t3 AS
SELECT ref_0.vkey AS c_0
FROM (t0 ref_0
LEFT JOIN t2 ref_1 ON ((ref_0.c1 = ref_1.c11)))
WHERE ((false < ( SELECT (ref_0.c1 <> ref_1.c14) AS c_0
FROM t2 ref_6
ORDER BY ref_0.c1, ref_1.c14
LIMIT 1)));
CREATE VIEW t6 AS SELECT 1 AS c_0, 2 AS c_1, 3 AS c_2;
INSERT INTO t1 VALUES (80, 90000);
ALTER TABLE ONLY t1 ADD CONSTRAINT t1_pkey PRIMARY KEY (pkey);
------------------------
The fuzzer generates Test case:
--- Test case ---
select
ref_38.c_0 as c_10
from
((t3 as ref_38
full outer join t6 as ref_39
on (ref_38.c_0 = ref_39.c_1))
right outer join t1 as ref_40
on (ref_38.c_0 = ref_40.vkey));
------------------------
--- Expected behavior ---
The test case should not trigger any error.
--- Actual behavior ---
The test case trigger an error:
ERROR: wrong varnullingrels (b) (expected (b 5)) for Var 6/2
--- Postgres version ---
Github commit: 3f1aaaa180689f2015e7f7bd01c9be6d7a993b42
Version: PostgreSQL 16beta1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
--- Platform information ---
Platform: Ubuntu 20.04
Kernel: Linux 5.4.0-147-generic