Skip to content

Unexpected results when using system information functions #16026

Closed

Description

@suyZhong

CrateDB version

CrateDB 5.8.0-SNAPSHOT built 0dcd1a0

CrateDB setup information

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

Problem description

Consider the test case below. It is unexpected that the last query returns -1, because the result of the second query is NULL, which means that the WHERE clause in the last query should be evaluated to NULL and thus the row should be filtered.

I also observed similar issues in CURRENT_SETTING and PG_GET_FUNCTION_RESULT

Steps to Reproduce

DROP TABLE IF EXISTS t0;

CREATE TABLE t0(c1 INTEGER);
INSERT INTO t0(c1) VALUES (-1);
REFRESH TABLE t0;

SELECT * FROM t0; -- -1
SELECT (NOT ((PG_ENCODING_TO_CHAR(t0.c1))<(false))) FROM t0; -- NULL
SELECT * FROM t0 WHERE (NOT ((PG_ENCODING_TO_CHAR(t0.c1))<(false)));
-- Expected: empty table
-- Actual: -1

Actual Result

-1

Expected Result

empty table

Activity

  1. added
    triageAn issue that needs to be triaged by a maintainer
    on May 26, 2024
  2. added
    bugClear identification of incorrect behaviour
    and removed
    triageAn issue that needs to be triaged by a maintainer
    on May 27, 2024
  3. self-assigned this
    on May 27, 2024
  4. jeeminso commented on May 28, 2024

    @jeeminso
    Contributor

    Thanks for reporting @suyZhong! The fix will be available in 5.7.2.

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

Metadata

Metadata

Assignees

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