Skip to content

Unexpected result when using IS DISTINCT FROM with AND #7534

Closed

Description

@suyZhong

Describe the bug
Executing a SELECT query with a condition using IS DISTINCT FROM inside a WHERE clause returns an empty result set when it should return a row. The expression should be evaluated to TRUE as shown in the second query, and thus the third query should fetch one row in the table

To Reproduce

DROP TABLE IF EXISTS t0 CASCADE;

CREATE TABLE t0(c0 VARCHAR);
INSERT INTO t0 (c0) VALUES ('a');

SELECT t0.c0 FROM t0; -- a
SELECT (1 AND ('' IS DISTINCT FROM t0.c0)) FROM t0; -- true
SELECT t0.c0 FROM t0 WHERE (1 AND ('' IS DISTINCT FROM t0.c0));
-- Expected: a
-- Actual: empty table

Expected behavior
As mentioned above.

Screenshots
N/A

Software versions
Build from source:

> docker exec -it monetdb-test mserver5 --version         
MonetDB 5 server 11.52.0 (hg id: 0fbb4da) (64-bit, 128-bit integers)
This is an unreleased version
Copyright (c) 1993 - July 2008 CWI
Copyright (c) August 2008 - 2023 MonetDB B.V., all rights reserved
Visit https://www.monetdb.org/ for further information
Found 503.5GiB available memory, 128 available cpu cores
Libraries:
Compiled by: @6a1bbdadc0f6 (x86_64-pc-linux-gnu)
Compilation: /usr/bin/cc 
Linking    : /usr/bin/ld

Issue labeling
Bug

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions