From 1b2078b4d8aa64bad8bc2b3a201e0cf8c075e6a6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 15 May 2018 17:34:47 +0200 Subject: MDEV-15318 CREATE .. SELECT VALUES produces invalid table structure When Item_insert_value needs a dummy field, use zero-length Field_string, not Field_null. The latter isn't compatible with CREATE ... SELECT. --- sql/item.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sql') diff --git a/sql/item.cc b/sql/item.cc index c5c6df0ec48..135255ee21e 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -8541,10 +8541,10 @@ bool Item_insert_value::fix_fields(THD *thd, Item **items) } else { - Field *tmp_field= field_arg->field; - /* charset doesn't matter here, it's to avoid sigsegv only */ - tmp_field= new Field_null(0, 0, Field::NONE, field_arg->field->field_name, - &my_charset_bin); + static uchar null_bit=1; + /* charset doesn't matter here */ + Field *tmp_field= new Field_string(0, 0, &null_bit, 1, Field::NONE, + field_arg->field->field_name, &my_charset_bin); if (tmp_field) { tmp_field->init(field_arg->field->table); -- cgit v1.2.1