Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Results Using NULLIF with VARCHAR #15325

Closed
suyZhong opened this issue Jan 11, 2024 · 2 comments · Fixed by #15329
Closed

Unexpected Results Using NULLIF with VARCHAR #15325

suyZhong opened this issue Jan 11, 2024 · 2 comments · Fixed by #15329
Assignees
Labels
bug Clear identification of incorrect behaviour

Comments

@suyZhong
Copy link

CrateDB version

CrateDB 5.6.0-SNAPSHOT built 5ff277c

CrateDB setup information

Manual build following the instructions here: https://github.com/crate/crate/blob/master/devs/docs/basics.rst

Problem description

The third SELECT returns one row (null), which is surprising, given that the result of second query is null. The value of the NULLI((t0.c1), NULL)) expression is null, and thus the third query should return empty.

Steps to Reproduce

DROP TABLE IF EXISTS t0;

CREATE TABLE t0( c1 VARCHAR(500));
INSERT INTO t0 (c1) VALUES (NULL);
REFRESH TABLE t0;

SELECT * FROM t0; -- null
SELECT (NOT NULLIF((t0.c1), NULL)) FROM t0; -- null
SELECT * FROM t0 WHERE (NOT NULLIF((t0.c1), NULL));
-- Expected: empty result
-- Actual:   null

Actual Result

NULL

Expected Result

Empty

@suyZhong suyZhong added the triage An issue that needs to be triaged by a maintainer label Jan 11, 2024
@matriv matriv added bug Clear identification of incorrect behaviour and removed triage An issue that needs to be triaged by a maintainer labels Jan 11, 2024
@matriv
Copy link
Contributor

matriv commented Jan 11, 2024

This is a bug only on current master, tested with 5.5.2 and a correct result (empty) is returned.

@matriv
Copy link
Contributor

matriv commented Jan 11, 2024

@suyZhong Thx a lot for reporting the issue, it was applicable only for master and it has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Clear identification of incorrect behaviour
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants