Skip to content

Unexpected result when using PG_GET_PARTKEYDEF #16172

Closed

Description

@suyZhong

CrateDB version

CrateDB 5.8.0-SNAPSHOT built 7a1ca39

CrateDB setup information

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

Problem description

The query using PG_GET_PARTKEYDEF and applying the NOT operator should result in a NULL value. Consequently, the WHERE clause should filter out all rows, resulting in an empty result set. However, the actual result set includes the row with the value 1, which indicates misbehavior.

Steps to Reproduce

DROP TABLE IF EXISTS t0;

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

SELECT * FROM t0; -- 1
SELECT (NOT (PG_GET_PARTKEYDEF(t0.c0))) FROM t0; -- NULL
SELECT * FROM t0 WHERE (NOT (PG_GET_PARTKEYDEF(t0.c0)));
-- 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 Jun 16, 2024
  2. added
    bugClear identification of incorrect behaviour
    and removed
    triageAn issue that needs to be triaged by a maintainer
    on Jun 17, 2024
  3. self-assigned this
    on Jun 17, 2024
  4. added 2 commits that reference this issue on Jun 17, 2024
    7de1ed3
    134f2e3
  5. added a commit that references this issue on Jun 17, 2024
    4678bf1
  6. matriv commented on Jun 17, 2024

    @matriv
    Contributor

    Thx a lot for spotting and reporting this @suyZhong, the fix will be available with the next hotfix release.

  7. added 2 commits that reference this issue on Jun 17, 2024
    0028922
    1beaefb
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