dolt
dolt copied to clipboard
subqueries should coerce union types
A union nested in a subquery or CTE is missing a type-normalization rule that otherwise applies outside of subqueries. In the query below, the union should be cast to a LONGTEXT.
create table enum_table (i int primary key, e enum('a', 'b');
insert into a values (1, 'a'), (2, 'b');
create table uv (u int primary key, v varchar(10));
insert into uv values (0,' bug'), (1, 'ant');
select * from ( select e from enum_table union select v from uv ) sq;
value bug is not valid for this Enum
With a as (
select e from enum_table
union
select v from uv
) select * from a;
value bug is not valid for this Enum