Commit 38c43ecd authored by unknown's avatar unknown
Browse files

Merge mysql.com:/usr/local/bk/mysql-5.0

into  mysql.com:/usr/home/pem/mysql-5.0


sql/sql_yacc.yy:
  Auto merged
parents a8d4bfd1 065a9377
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -786,3 +786,50 @@ END|
ERROR 0A000: HANDLER is not allowed in stored procedures
SELECT bug12995()|
ERROR 42000: FUNCTION test.bug12995 does not exist
drop procedure if exists bug12712;
drop function if exists bug12712;
create procedure bug12712()
set session autocommit = 0;
select @@autocommit;
@@autocommit
1
set @au = @@autocommit;
call bug12712();
select @@autocommit;
@@autocommit
0
set session autocommit = @au;
create function bug12712()
returns int
begin
call bug12712();
return 0;
end|
set @x = bug12712()|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
drop procedure bug12712|
drop function bug12712|
create function bug12712()
returns int
begin
set session autocommit = 0;
return 0;
end|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create function bug12712()
returns int
begin
set @@autocommit = 0;
return 0;
end|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create function bug12712()
returns int
begin
set local autocommit = 0;
return 0;
end|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create trigger bug12712
before insert on t1 for each row set session autocommit = 0;
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
+58 −0
Original line number Diff line number Diff line
@@ -1130,6 +1130,64 @@ END|
SELECT bug12995()|
delimiter ;|


#
# BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
#
--disable_warnings
drop procedure if exists bug12712;
drop function if exists bug12712;
--enable_warnings
# Can...
create procedure bug12712()
  set session autocommit = 0;

select @@autocommit;
set @au = @@autocommit;
call bug12712();
select @@autocommit;
set session autocommit = @au;

delimiter |;
create function bug12712()
  returns int
begin
  call bug12712();
  return 0;
end|

# Can't...
--error ER_SP_CANT_SET_AUTOCOMMIT
set @x = bug12712()|
drop procedure bug12712|
drop function bug12712|
--error ER_SP_CANT_SET_AUTOCOMMIT
create function bug12712()
    returns int
begin
  set session autocommit = 0;
  return 0;
end|
--error ER_SP_CANT_SET_AUTOCOMMIT
create function bug12712()
    returns int
begin
  set @@autocommit = 0;
  return 0;
end|
--error ER_SP_CANT_SET_AUTOCOMMIT
create function bug12712()
    returns int
begin
  set local autocommit = 0;
  return 0;
end|
delimiter ;|
--error ER_SP_CANT_SET_AUTOCOMMIT
create trigger bug12712
  before insert on t1 for each row set session autocommit = 0;


#
# BUG#NNNN: New bug synopsis
#
+4 −4
Original line number Diff line number Diff line
@@ -447,7 +447,7 @@ sys_var_thd_date_time_format sys_datetime_format("datetime_format",

/* Variables that are bits in THD */

static sys_var_thd_bit	sys_autocommit("autocommit", 0,
sys_var_thd_bit sys_autocommit("autocommit", 0,
                               set_option_autocommit,
                               OPTION_NOT_AUTOCOMMIT,
                               1);
+1 −0
Original line number Diff line number Diff line
@@ -905,6 +905,7 @@ extern sys_var_const_str sys_charset_system;
extern sys_var_str sys_init_connect;
extern sys_var_str sys_init_slave;
extern sys_var_thd_time_zone sys_time_zone;
extern sys_var_thd_bit sys_autocommit;
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
		NAMED_LIST **found);
+2 −0
Original line number Diff line number Diff line
@@ -5403,3 +5403,5 @@ ER_VIEW_PREVENT_UPDATE
        eng "The definition of table '%-.64s' prevents operation %s on table '%-.64s'."
ER_PS_NO_RECURSION
        eng "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner"
ER_SP_CANT_SET_AUTOCOMMIT
	eng "Not allowed to set autocommit from a stored function or trigger"
Loading