Skip to content

Equivalent view extraction retags UNION ALL integer payload as ENUM text #290

Description

@123lpygithub

Under semantic-equivalent rewriting, the source and mutated queries are logically equivalent, but produce different results on PolarDB-X.

version:5.4.19-SNAPSHOT

How to repeat:

DROP DATABASE IF EXISTS vect_submit_c1;
CREATE DATABASE vect_submit_c1;
USE vect_submit_c1;

CREATE TABLE t2 (
  c10 ENUM('value1','value2','value3')
);

INSERT INTO t2 VALUES ('value3');

-- View SQL
CREATE VIEW v AS
SELECT 1 AS dummy;

-- Source Original SQL
SELECT c10 AS col1
FROM t2
UNION ALL
SELECT 3 AS col1;

-- Mutated SQL
SELECT c10 AS col1
FROM t2 JOIN v
UNION ALL
SELECT 3 AS col1;

Observed result - Query A (original):

col1
value3
3

Observed result - Query B (mutated):

col1
value3
value3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions