Skip to content

sql: incorrect grouping of array with NULL #44079

@madelynnblue

Description

@madelynnblue
SELECT
    a, a IS NULL AS isnull
FROM
    (
        VALUES
            (NULL),
            ((NULL::TIMESTAMP || NULL::TIMESTAMP[]))
    )
        AS t (a);

SELECT
    *
FROM
    (
        VALUES
            (NULL),
            ((NULL::TIMESTAMP || NULL::TIMESTAMP[]))
    )
        AS t (a)
GROUP BY
    a;

In postgres:

   a    | isnull 
--------+--------
        | t
 {NULL} | f
(2 rows)

   a    
--------
 {NULL}
 
(2 rows)

Cockroach:

   a    | isnull 
--------+--------
        | t
 {NULL} | f
(2 rows)

 a 
---
 
(1 row)

It seems that we are incorrectly grouping an array with a null with a regular null.

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-sqlsmith

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions