[MDEV-12656] Crash in CREATE..SELECT..UNION with a ENUM column and NULL Created: 2017-05-02  Updated: 2017-05-02  Resolved: 2017-05-02

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.3
Fix Version/s: 10.3.1

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-12588 Add Type_handler::type_handler_for_tm... Closed

 Description   

This is a 10.3 specific problem.

This script makes the server crash:

CREATE OR REPLACE TABLE t1 (a ENUM('a1'));
CREATE OR REPLACE TABLE t2 AS SELECT (SELECT a FROM t1 UNION SELECT NULL);

with this stack trace:

#0  0x00007ffff5ddaa28 in raise () from /lib64/libc.so.6
#1  0x00007ffff5ddc62a in abort () from /lib64/libc.so.6
#2  0x00007ffff5dd3227 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff5dd32d2 in __assert_fail () from /lib64/libc.so.6
#4  0x0000555555d13f72 in Type_handler_enum::make_table_field (
    this=0x5555571cd9c8 <type_handler_enum>, name=0x7ffe70013b90, addr=..., 
    attr=..., table=0x7ffff4197260)
    at /home/bar/maria-git/server.10.2-ext/sql/sql_type.cc:1628
#5  0x0000555555d12cba in Type_handler::make_and_init_table_field (
    this=0x5555571cd9c8 <type_handler_enum>, name=0x7ffe70013b90, addr=..., 
    attr=..., table=0x7ffff4197260)
    at /home/bar/maria-git/server.10.2-ext/sql/sql_type.cc:1218
#6  0x0000555555a7c89b in Item::tmp_table_field_from_field_type (
    this=0x7ffe70013b40, table=0x7ffff4197260)
    at /home/bar/maria-git/server.10.2-ext/sql/item.h:553

Note, if I change the CREATE..SELECT not to use UNION, it works fine:

CREATE OR REPLACE TABLE t1 (a ENUM('a1'));
CREATE OR REPLACE TABLE t2 AS SELECT (SELECT a FROM t1);



 Comments   
Comment by Alexander Barkov [ 2017-05-02 ]

Pushed to bb-10.2.ext

Generated at Thu Feb 08 07:59:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.