summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/kill.result14
-rw-r--r--mysql-test/t/kill.test6
-rw-r--r--sql/sql_yacc.yy20
3 files changed, 28 insertions, 12 deletions
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index e9d41c104dd..c390745da16 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -15,6 +15,20 @@ select 4;
4
4
drop table t1;
+kill (select count(*) from mysql.user);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select count(*) from mysql.user)' at line 1
+create table t1 (id int primary key);
+create table t2 (id int unsigned not null);
+insert into t2 select id from t1;
+create table t3 (kill_id int);
+insert into t3 values(connection_id());
+ select id from t1 where id in (select distinct id from t2);
+select ((@id := kill_id) - kill_id) from t3;
+((@id := kill_id) - kill_id)
+0
+kill @id;
+Got one of the listed errors
+drop table t1, t2, t3;
create table t1 (id int primary key);
create table t2 (id int unsigned not null);
insert into t2 select id from t1;
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 8302c767985..eaeb174248b 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -46,8 +46,12 @@ select @id != connection_id();
connection con2;
select 4;
drop table t1;
-
connection default;
+disconnect con2;
+
+--error 1064
+kill (select count(*) from mysql.user);
+
#
# BUG#14851: killing long running subquery processed via a temporary table.
#
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 86d50bcd707..2ce53996cfa 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5490,9 +5490,8 @@ select_derived2:
{
LEX *lex= Lex;
lex->derived_tables|= DERIVED_SUBQUERY;
- if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
- lex->sql_command <= (int)SQLCOM_HA_READ) ||
- lex->sql_command == (int)SQLCOM_KILL)
+ if (lex->sql_command == (int)SQLCOM_HA_READ ||
+ lex->sql_command == (int)SQLCOM_KILL)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
@@ -6891,18 +6890,18 @@ purge_option:
/* kill threads */
kill:
- KILL_SYM kill_option expr
+ KILL_SYM { Lex->sql_command= SQLCOM_KILL; } kill_option expr
{
LEX *lex=Lex;
lex->value_list.empty();
- lex->value_list.push_front($3);
- lex->sql_command= SQLCOM_KILL;
+ lex->value_list.push_front($4);
};
kill_option:
/* empty */ { Lex->type= 0; }
| CONNECTION_SYM { Lex->type= 0; }
- | QUERY_SYM { Lex->type= ONLY_KILL_QUERY; };
+ | QUERY_SYM { Lex->type= ONLY_KILL_QUERY; }
+ ;
/* change database */
@@ -6915,7 +6914,7 @@ use: USE_SYM ident
/* import, export of files */
-load: LOAD DATA_SYM
+load: LOAD DATA_SYM
{
LEX *lex=Lex;
if (lex->sphead)
@@ -8939,9 +8938,8 @@ subselect_start:
'(' SELECT_SYM
{
LEX *lex=Lex;
- if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
- lex->sql_command <= (int)SQLCOM_HA_READ) ||
- lex->sql_command == (int)SQLCOM_KILL)
+ if (lex->sql_command == (int)SQLCOM_HA_READ ||
+ lex->sql_command == (int)SQLCOM_KILL)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;