MDEV-26637: (variables) ASAN: main.metadata and user_variables.basic MTR failures after MDEV-26572
Prohibit user variables without name
This commit is contained in:
parent
af8b2c6cec
commit
8f7edb784f
@ -784,7 +784,7 @@ SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
|
|||||||
# Bug#13012483: EXPLAIN EXTENDED, PREPARED STATEMENT, CRASH IN CHECK_SIMPLE_EQUALITY
|
# Bug#13012483: EXPLAIN EXTENDED, PREPARED STATEMENT, CRASH IN CHECK_SIMPLE_EQUALITY
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 (a INT);
|
CREATE TABLE t1 (a INT);
|
||||||
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @a:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
||||||
EXECUTE s;
|
EXECUTE s;
|
||||||
1
|
1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@ -805,15 +805,6 @@ select * from t1 where IF(1,a,a)='2.1';
|
|||||||
a b
|
a b
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
# LP bug#992380 Crash when creating PS for a query with
|
|
||||||
# subquery in WHERE (see also mysql bug#13012483)
|
|
||||||
#
|
|
||||||
CREATE TABLE t1 (a INT);
|
|
||||||
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
|
||||||
EXECUTE s;
|
|
||||||
1
|
|
||||||
DROP TABLE t1;
|
|
||||||
#
|
|
||||||
# End of 5.3 tests
|
# End of 5.3 tests
|
||||||
#
|
#
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
|
@ -567,7 +567,7 @@ SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
|
|||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
CREATE TABLE t1 (a INT);
|
CREATE TABLE t1 (a INT);
|
||||||
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @a:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
||||||
EXECUTE s;
|
EXECUTE s;
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@ -595,15 +595,6 @@ select * from t1 where a='2.1';
|
|||||||
select * from t1 where b='2.1';
|
select * from t1 where b='2.1';
|
||||||
select * from t1 where IF(1,a,a)='2.1';
|
select * from t1 where IF(1,a,a)='2.1';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
--echo #
|
|
||||||
--echo # LP bug#992380 Crash when creating PS for a query with
|
|
||||||
--echo # subquery in WHERE (see also mysql bug#13012483)
|
|
||||||
--echo #
|
|
||||||
CREATE TABLE t1 (a INT);
|
|
||||||
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
|
||||||
EXECUTE s;
|
|
||||||
|
|
||||||
DROP TABLE t1;
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 5.3 tests
|
--echo # End of 5.3 tests
|
||||||
|
@ -553,19 +553,19 @@ d0l d09 d10
|
|||||||
# MDEV-12862 Data type of @a:=1e0 depends on the session character set
|
# MDEV-12862 Data type of @a:=1e0 depends on the session character set
|
||||||
#
|
#
|
||||||
SET NAMES utf8;
|
SET NAMES utf8;
|
||||||
CREATE TABLE t1 AS SELECT @:=1e0;
|
CREATE TABLE t1 AS SELECT @a:=1e0;
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def test t1 t1 @:=1e0 @:=1e0 5 3 1 N 36865 31 63
|
def test t1 t1 @a:=1e0 @a:=1e0 5 3 1 N 36865 31 63
|
||||||
@:=1e0
|
@a:=1e0
|
||||||
1
|
1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET NAMES latin1;
|
SET NAMES latin1;
|
||||||
CREATE TABLE t1 AS SELECT @:=1e0;
|
CREATE TABLE t1 AS SELECT @a:=1e0;
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def test t1 t1 @:=1e0 @:=1e0 5 3 1 N 36865 31 63
|
def test t1 t1 @a:=1e0 @a:=1e0 5 3 1 N 36865 31 63
|
||||||
@:=1e0
|
@a:=1e0
|
||||||
1
|
1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
@ -345,11 +345,11 @@ SELECT
|
|||||||
--echo #
|
--echo #
|
||||||
--enable_metadata
|
--enable_metadata
|
||||||
SET NAMES utf8;
|
SET NAMES utf8;
|
||||||
CREATE TABLE t1 AS SELECT @:=1e0;
|
CREATE TABLE t1 AS SELECT @a:=1e0;
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET NAMES latin1;
|
SET NAMES latin1;
|
||||||
CREATE TABLE t1 AS SELECT @:=1e0;
|
CREATE TABLE t1 AS SELECT @a:=1e0;
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
--disable_metadata
|
--disable_metadata
|
||||||
|
@ -29,13 +29,13 @@ SET @dec_var=CAST(1 AS DECIMAL(20, 10));
|
|||||||
SET @time_var=CAST('2016-02-25' AS DATE);
|
SET @time_var=CAST('2016-02-25' AS DATE);
|
||||||
SET @' @#^%'='Value of variable with odd name';
|
SET @' @#^%'='Value of variable with odd name';
|
||||||
SET @''='Value of variable with empty name';
|
SET @''='Value of variable with empty name';
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '='Value of variable with empty name'' at line 1
|
||||||
SET @null_var=NULL;
|
SET @null_var=NULL;
|
||||||
SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES;
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES;
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
10
|
9
|
||||||
SELECT * FROM INFORMATION_SCHEMA.USER_VARIABLES ORDER BY VARIABLE_NAME;
|
SELECT * FROM INFORMATION_SCHEMA.USER_VARIABLES ORDER BY VARIABLE_NAME;
|
||||||
VARIABLE_NAME VARIABLE_VALUE VARIABLE_TYPE CHARACTER_SET_NAME
|
VARIABLE_NAME VARIABLE_VALUE VARIABLE_TYPE CHARACTER_SET_NAME
|
||||||
Value of variable with empty name VARCHAR latin1
|
|
||||||
@#^% Value of variable with odd name VARCHAR latin1
|
@#^% Value of variable with odd name VARCHAR latin1
|
||||||
dec_var 1.0000000000 DECIMAL latin1
|
dec_var 1.0000000000 DECIMAL latin1
|
||||||
double_var 1 DOUBLE latin1
|
double_var 1 DOUBLE latin1
|
||||||
@ -47,7 +47,6 @@ uint_var 2 INT UNSIGNED latin1
|
|||||||
utf8str_var UTF8 string value VARCHAR utf8mb3
|
utf8str_var UTF8 string value VARCHAR utf8mb3
|
||||||
SHOW USER_VARIABLES;
|
SHOW USER_VARIABLES;
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Value of variable with empty name
|
|
||||||
@#^% Value of variable with odd name
|
@#^% Value of variable with odd name
|
||||||
dec_var 1.0000000000
|
dec_var 1.0000000000
|
||||||
double_var 1
|
double_var 1
|
||||||
|
@ -12,6 +12,7 @@ SET @double_var=CAST(1 AS DOUBLE);
|
|||||||
SET @dec_var=CAST(1 AS DECIMAL(20, 10));
|
SET @dec_var=CAST(1 AS DECIMAL(20, 10));
|
||||||
SET @time_var=CAST('2016-02-25' AS DATE);
|
SET @time_var=CAST('2016-02-25' AS DATE);
|
||||||
SET @' @#^%'='Value of variable with odd name';
|
SET @' @#^%'='Value of variable with odd name';
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
SET @''='Value of variable with empty name';
|
SET @''='Value of variable with empty name';
|
||||||
SET @null_var=NULL;
|
SET @null_var=NULL;
|
||||||
|
|
||||||
|
@ -3555,6 +3555,11 @@ simple_target_specification:
|
|||||||
}
|
}
|
||||||
| '@' ident_or_text
|
| '@' ident_or_text
|
||||||
{
|
{
|
||||||
|
if (!$2.length)
|
||||||
|
{
|
||||||
|
thd->parse_error();
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
$$= new (thd->mem_root) Item_func_get_user_var(thd, &$2);
|
$$= new (thd->mem_root) Item_func_get_user_var(thd, &$2);
|
||||||
if (unlikely($$ == NULL))
|
if (unlikely($$ == NULL))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
@ -10934,6 +10939,11 @@ variable_aux:
|
|||||||
ident_or_text SET_VAR expr
|
ident_or_text SET_VAR expr
|
||||||
{
|
{
|
||||||
Item_func_set_user_var *item;
|
Item_func_set_user_var *item;
|
||||||
|
if (!$1.length)
|
||||||
|
{
|
||||||
|
thd->parse_error();
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
$$= item= new (thd->mem_root) Item_func_set_user_var(thd, &$1, $3);
|
$$= item= new (thd->mem_root) Item_func_set_user_var(thd, &$1, $3);
|
||||||
if (unlikely($$ == NULL))
|
if (unlikely($$ == NULL))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
@ -10943,6 +10953,11 @@ variable_aux:
|
|||||||
}
|
}
|
||||||
| ident_or_text
|
| ident_or_text
|
||||||
{
|
{
|
||||||
|
if (!$1.length)
|
||||||
|
{
|
||||||
|
thd->parse_error();
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
$$= new (thd->mem_root) Item_func_get_user_var(thd, &$1);
|
$$= new (thd->mem_root) Item_func_get_user_var(thd, &$1);
|
||||||
if (unlikely($$ == NULL))
|
if (unlikely($$ == NULL))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
@ -12584,6 +12599,12 @@ select_var_ident: select_outvar
|
|||||||
select_outvar:
|
select_outvar:
|
||||||
'@' ident_or_text
|
'@' ident_or_text
|
||||||
{
|
{
|
||||||
|
if (!$2.length)
|
||||||
|
{
|
||||||
|
thd->parse_error();
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
|
||||||
$$ = Lex->result ? new (thd->mem_root) my_var_user(&$2) : NULL;
|
$$ = Lex->result ? new (thd->mem_root) my_var_user(&$2) : NULL;
|
||||||
}
|
}
|
||||||
| ident_or_text
|
| ident_or_text
|
||||||
@ -14564,6 +14585,12 @@ field_or_var:
|
|||||||
simple_ident_nospvar {$$= $1;}
|
simple_ident_nospvar {$$= $1;}
|
||||||
| '@' ident_or_text
|
| '@' ident_or_text
|
||||||
{
|
{
|
||||||
|
if (!$2.length)
|
||||||
|
{
|
||||||
|
thd->parse_error();
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
|
||||||
$$= new (thd->mem_root) Item_user_var_as_out_param(thd, &$2);
|
$$= new (thd->mem_root) Item_user_var_as_out_param(thd, &$2);
|
||||||
if (unlikely($$ == NULL))
|
if (unlikely($$ == NULL))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
@ -16379,6 +16406,12 @@ option_value_no_option_type:
|
|||||||
}
|
}
|
||||||
| '@' ident_or_text equal
|
| '@' ident_or_text equal
|
||||||
{
|
{
|
||||||
|
if (!$2.length)
|
||||||
|
{
|
||||||
|
thd->parse_error();
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
|
||||||
if (sp_create_assignment_lex(thd, $1.str))
|
if (sp_create_assignment_lex(thd, $1.str))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user