diff options
author | unknown <dlenev@mysql.com> | 2005-08-18 19:07:23 +0400 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2005-08-18 19:07:23 +0400 |
commit | b1921c85ba5e1892af48df31ad38a89f65989012 (patch) | |
tree | a406bd694879e8704ece8ccd2c5c789c021da599 /mysql-test/r/sp-error.result | |
parent | 6ff38ce778a52d4117a12acb2eed5cc0b5213e8a (diff) | |
download | mariadb-git-b1921c85ba5e1892af48df31ad38a89f65989012.tar.gz |
Fix for bug #11896 "Partial locking in case of recursive trigger definitions".
If we are in stored function or trigger we should ensure that we won't change
table that is already used by calling statement (this can damage table or
easily cause infinite loops). Particularly this means that recursive triggers
should be disallowed.
mysql-test/r/sp-error.result:
Added tests checking that in functions we don't allow to update tables which
are used by statements which invoke these functions.
mysql-test/r/trigger.result:
Added test for bug #11896 "Partial locking in case of recursive trigger
definitions".
mysql-test/t/sp-error.test:
Added tests checking that in functions we don't allow to update tables which
are used by statements which invoke these functions.
mysql-test/t/trigger.test:
Added test for bug #11896 "Partial locking in case of recursive trigger
definitions".
sql/share/errmsg.txt:
Added error messages for complaining about situations when in function or
trigger we try to change table which is used in statement invoking this
function or trigger.
sql/sql_base.cc:
open_table():
If we are in stored function or trigger we should ensure that
we won't change table that is already used by calling statement
(this can damage table or easily cause infinite loops).
So if we are opening table for writing, we should check that it
is not already open by some calling stamement.
Diffstat (limited to 'mysql-test/r/sp-error.result')
-rw-r--r-- | mysql-test/r/sp-error.result | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index bd383379abc..4ac29a07757 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -299,6 +299,36 @@ lock tables t1 read, mysql.proc read| unlock tables| lock tables mysql.proc write| unlock tables| +drop function if exists f1| +create function f1(i int) returns int +begin +insert into t1 (val) values (i); +return 0; +end| +select val, f1(val) from t1| +ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. +select val, f1(val) from t1 as tab| +ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. +select * from t1| +val x +42 3.1 +19 1.2 +update t1 set val= f1(val)| +ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. +select * from t1| +val x +42 3.1 +19 1.2 +select f1(17)| +f1(17) +0 +select * from t1| +val x +42 3.1 +19 1.2 +17 NULL +delete from t1 where val= 17| +drop function f1| create procedure bug1965() begin declare c cursor for select val from t1 order by valname; |