Skip to content

Grouped BIT bytes change when consumed by GROUP_CONCAT after view materialization. #164

Description

@123lpygithub

Under SQL-equivalent rewriting, the source and mutated queries differ only in extracting the grouped BIT(1) subquery into a view. The GROUP_CONCAT(... ORDER BY ...) result changes from ASCII byte 0x31 to raw byte 0x01.

Version: 8.0.44-alisql-dev

How to repeat:

DROP VIEW IF EXISTS v;
DROP TABLE IF EXISTS t;

CREATE TABLE t (
  x BIT(1) NOT NULL
);

INSERT INTO t VALUES (b'1');

-- Original SQL
SELECT GROUP_CONCAT(x ORDER BY x)
FROM (
  SELECT x
  FROM t
  GROUP BY x
) q;

-- View SQL
CREATE VIEW v AS
SELECT x
FROM (
  SELECT x
  FROM t
  GROUP BY x
) q;

-- Mutated SQL
SELECT GROUP_CONCAT(x ORDER BY x)
FROM v;

Observed mismatch:

  • original result:
GROUP_CONCAT(x ORDER BY x)
0x31
  • mutated result:
GROUP_CONCAT(x ORDER BY x)
0x01

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions