Skip to content

Unexpected result when comparing STRUCT with INET #13924

@suyZhong

Description

@suyZhong

What happens?

Consider the following test case generated by my fuzzer. There should be an issue in either the second query or the third, since the second query return NULL, and thus the third query should return an empty table. However, one row is fetched.

I built duckdb with CORE_EXTENSIONS='inet' GEN=ninja make. It could also be triggered by nightly build of duckdb-java.

To Reproduce

CREATE TABLE  t1(c0 INT, c1 INET);
INSERT INTO t1(c0, c1) VALUES (1, '192.168.1.1');

SELECT * FROM t1; -- 1 192.168.1.1
SELECT ((NULL, t1.c0, NULL)<>(t1.c1)) FROM t1; -- NULL
SELECT * FROM t1 WHERE ((NULL, t1.c0, NULL)<>(t1.c1));
-- Expected: empty
-- Actual: 1 192.168.1.1

-- original test case found by TLP
SELECT * FROM t1 WHERE ((NULL, t1.c0, NULL)<>(t1.c1)) UNION ALL SELECT * FROM t1 WHERE (NOT ((NULL, t1.c0, NULL)<>(t1.c1))) UNION ALL SELECT * FROM t1 WHERE ((((NULL, t1.c0, NULL)<>(t1.c1))) IS NULL);
-- 2 rows (unexpected)

OS:

Ubuntu 22.04

DuckDB Version:

v1.1.1-dev116 a2c119f

DuckDB Client:

CLI

Hardware:

No response

Full Name:

Suyang Zhong

Affiliation:

NUS

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a source build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions