Commit 833f4486 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition

This is a temporary fix for 10.2.
This problem was permanently fixed in 10.9 under terms of MDEV-27743.

This patch should propagate up to 10.8 then null-merged to 10.9.
parent 4d1955d3
......@@ -754,3 +754,20 @@ hex(b)
61
drop table t1;
#
# Start of 10.2 tests
#
#
# MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
#
CREATE TABLE t1 (a CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT);
DROP TABLE t1;
SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT);
CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT)
a
SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1;
c1
string
#
# End of 10.2 tests
#
......@@ -339,3 +339,20 @@ select hex(b) from t1 where b<'zzz' order by b;
drop table t1;
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
--echo #
CREATE TABLE t1 (a CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT);
DROP TABLE t1;
SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT);
SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -1916,6 +1916,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <charset>
opt_collate
collate
charset_name
charset_or_alias
charset_name_or_default
......@@ -6776,10 +6777,7 @@ charset_or_alias:
}
;
collate: COLLATE_SYM collation_name_or_default
{
Lex->charset= Lex->last_field->charset= $2;
}
collate: COLLATE_SYM collation_name_or_default { $$= $2; }
;
opt_binary:
......@@ -6790,11 +6788,17 @@ opt_binary:
| BINARY charset_or_alias { bincmp_collation($2, true); }
| charset_or_alias collate
{
if (!my_charset_same(Lex->charset, $1))
if (!$2)
Lex->charset= $1; // CHARACTER SET cs COLLATE DEFAULT
else
{
if (!my_charset_same($2, $1))
my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
Lex->charset->name, $1->csname));
$2->name, $1->csname));
Lex->charset= $2;
}
}
| collate { }
| collate { Lex->charset= $1; }
;
opt_bin_mod:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment