Skip to content

Unexpected Results Using NULLIF #15121

Closed

Description

@suyZhong

CrateDB version

5.6.0-SNAPSHOT built ff1e7f7

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 an empty result, which is surprising, given that the result of second query is TRUE. The value of the NULLIF expression is TRUE, and thus the third query should return the whole table.

Steps to Reproduce

CREATE TABLE t0(c0 INTEGER);
INSERT INTO t0(c0) VALUES (NULL);

SELECT * FROM t0; -- NULL
SELECT NULLIF(2, c0)!=1 FROM t0; -- TRUE
SELECT * FROM t0 WHERE NULLIF(2, c0)!=1; 

Actual Result

empty table

Expected Result

NULL

Activity

  1. added
    triageAn issue that needs to be triaged by a maintainer
    on Nov 29, 2023
  2. added
    bugClear identification of incorrect behaviour
    and removed
    triageAn issue that needs to be triaged by a maintainer
    on Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugClear identification of incorrect behaviour

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions