Skip to content

Scan error on Nullable( Enum(..) ): converting NULL to string is unsupported #807

Open
@sergey-v9

Description

@sergey-v9

For the nullable enum column (in this case, 'status') Query Builder fails to select the column as is and displays the error message:
sql: Scan error on column index 2, name "status": converting NULL to string is unsupported: Could not process SQL results

As a workaround, this can be fixed by manually wrapping the enum column with toString() function in SQL Editor.

Sample table to reproduce:

CREATE TABLE test_nullable_enum
(
    timestamp DateTime64, 
    id String(64),
    status Nullable(
        Enum(
            'Success' = 1,
            'Fail' = 2
        )
    )
) ENGINE = MergeTree
ORDER BY id;

INSERT INTO test_nullable_enum (timestamp, id, status) VALUES ('2024-04-18 00:00:00.000', 'i0', NULL);
INSERT INTO test_nullable_enum (timestamp, id, status) VALUES ('2024-04-18 11:11:11.000', 'i1', 'Success');
INSERT INTO test_nullable_enum (timestamp, id, status) VALUES ('2024-04-18 22:22:22.000', 'i2', 'Fail');

SELECT * FROM test_nullable_enum;

Screenshots

image

image

image

Environment:

  • Grafana version: v10.4.2 (701c851be7) Docker image grafana/grafana-oss:10.4.2
  • Plugin version: 4.0.6
  • OS Grafana is installed on: linux/amd64 (Docker for Windows)
  • User OS & Browser: Windows 11, Google Chrome 124

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Incoming

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions