Commit cfc99ce4 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

fixed SET with subselect

parent 7c827899
...@@ -848,6 +848,13 @@ do @a:=(SELECT a from t); ...@@ -848,6 +848,13 @@ do @a:=(SELECT a from t);
select @a; select @a;
@a @a
1 1
set @a:=2;
set @a:=(SELECT a from t);
select @a;
@a
1
drop table t; drop table t;
do (SELECT a from t); do (SELECT a from t);
Table 'test.t' doesn't exist Table 'test.t' doesn't exist
set @a:=(SELECT a from t);
Table 'test.t' doesn't exist
...@@ -468,6 +468,11 @@ create table t (a int); ...@@ -468,6 +468,11 @@ create table t (a int);
insert into t values (1); insert into t values (1);
do @a:=(SELECT a from t); do @a:=(SELECT a from t);
select @a; select @a;
set @a:=2;
set @a:=(SELECT a from t);
select @a;
drop table t; drop table t;
-- error 1146 -- error 1146
do (SELECT a from t); do (SELECT a from t);
-- error 1146
set @a:=(SELECT a from t);
\ No newline at end of file
...@@ -2470,9 +2470,16 @@ mysql_execute_command(THD *thd) ...@@ -2470,9 +2470,16 @@ mysql_execute_command(THD *thd)
break; break;
} }
case SQLCOM_SET_OPTION: case SQLCOM_SET_OPTION:
if (!(res=sql_set_variables(thd, &lex->var_list))) if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) ||
(res= open_and_lock_tables(thd,tables))))
break;
fix_tables_pointers(lex->all_selects_list);
if (!(res= sql_set_variables(thd, &lex->var_list)))
send_ok(thd); send_ok(thd);
if (thd->net.report_error)
res= -1;
break; break;
case SQLCOM_UNLOCK_TABLES: case SQLCOM_UNLOCK_TABLES:
unlock_locked_tables(thd); unlock_locked_tables(thd);
if (thd->options & OPTION_TABLE_LOCK) if (thd->options & OPTION_TABLE_LOCK)
......
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