Hi Sergei, On 12/28/2016 08:01 PM, Sergei Golubchik wrote: > Hi, Alexander! > > On Dec 26, Alexander Barkov wrote: >> Hello Sergei, >> >> can you please review a fix for MDEV-11134. > > Sure. Where is it? :)
Sorry, forgot to attach it. > > Regards, > Sergei > Chief Architect MariaDB > and [email protected] >
commit 625b41955028061508df87885a97c46d414e910e Author: Alexander Barkov <[email protected]> Date: Mon Dec 26 07:48:03 2016 +0400 MDEV-11134 Assertion `fixed' failed in Item::const_charset_converter(THD*, CHARSET_INFO*, bool, const char*) diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index efc2ec6..06e2a8a 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -3234,6 +3234,44 @@ INSERT INTO t1 VALUES (1),(2),(3); EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT; ERROR HY000: Default/ignore value is not supported for such parameter usage DROP TABLE t1; +# +# MDEV-11134 Assertion `fixed' failed in Item::const_charset_converter(THD*, CHARSET_INFO*, bool, const char*) +# +SET NAMES utf8; +PREPARE stmt FROM "CREATE OR REPLACE TABLE t1 (c CHAR(8) DEFAULT ?)"; +SET @a=''; +EXECUTE stmt USING @a; +EXECUTE stmt USING @a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(8) DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET @a='A'; +EXECUTE stmt USING @a; +EXECUTE stmt USING @a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(8) DEFAULT 'A' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET @a=_utf8 0xC380; +EXECUTE stmt USING @a; +EXECUTE stmt USING @a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(8) DEFAULT 'Ã' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET @a=_utf8 0xD18F; +EXECUTE stmt USING @a; +ERROR 42000: Invalid default value for 'c' +EXECUTE stmt USING @a; +ERROR 42000: Invalid default value for 'c' +DEALLOCATE PREPARE stmt; # end of 10.2 test set sql_mode=ansi_quotes; create table t1 (a int, b int default (a+1)); diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test index d9d7f42..68dd2c3 100644 --- a/mysql-test/t/default.test +++ b/mysql-test/t/default.test @@ -1974,6 +1974,36 @@ EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFA DROP TABLE t1; +--echo # +--echo # MDEV-11134 Assertion `fixed' failed in Item::const_charset_converter(THD*, CHARSET_INFO*, bool, const char*) +--echo # + +SET NAMES utf8; +PREPARE stmt FROM "CREATE OR REPLACE TABLE t1 (c CHAR(8) DEFAULT ?)"; +SET @a=''; +EXECUTE stmt USING @a; +EXECUTE stmt USING @a; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET @a='A'; +EXECUTE stmt USING @a; +EXECUTE stmt USING @a; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET @a=_utf8 0xC380; # LATIN CAPITAL LETTER A WITH GRAVE +EXECUTE stmt USING @a; +EXECUTE stmt USING @a; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET @a=_utf8 0xD18F; # Cyrillic letter into a latin1 column +--error ER_INVALID_DEFAULT +EXECUTE stmt USING @a; +--error ER_INVALID_DEFAULT +EXECUTE stmt USING @a; +DEALLOCATE PREPARE stmt; + + + --echo # end of 10.2 test # diff --git a/sql/item.cc b/sql/item.cc index ead45f8..7791a32 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1236,7 +1236,11 @@ Item *Item::const_charset_converter(THD *thd, CHARSET_INFO *tocs, const char *func_name) { DBUG_ASSERT(const_item()); - DBUG_ASSERT(fixed); + /* + Item_param with an assigned value is basic_const_item(), but can be !fixed: + CREATE TABLE t1 (c CHAR(8) DEFAULT ?) + */ + DBUG_ASSERT(fixed || basic_const_item()); StringBuffer<64>tmp; String *s= val_str(&tmp); MEM_ROOT *mem_root= thd->mem_root;
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp

