diff options
author | unknown <dlenev@mysql.com> | 2005-12-11 15:26:15 +0300 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2005-12-11 15:26:15 +0300 |
commit | 7402f669c6b84336769c8180e72f1da50194da74 (patch) | |
tree | 43da40f96d1e19f102b386833bc0f71bfd569696 /mysql-test/t/trigger.test | |
parent | 4d87cf984dde6ca1ae91375375481dfada3d0c85 (diff) | |
download | mariadb-git-7402f669c6b84336769c8180e72f1da50194da74.tar.gz |
Fix for bug #14863 "Triggers: crash if create and there is no current database".
Now when we create or drop trigger we check that both trigger name and trigger
table always have database part specified. Thus we give an error if it they
are not specified explicitly or implicitly via current database.
mysql-test/r/trigger.result:
Added test for bug #14863 "Triggers: crash if create and there is no current
database".
mysql-test/t/trigger.test:
Added test for bug #14863 "Triggers: crash if create and there is no current
database".
sql/sql_trigger.cc:
mysql_create_or_drop_trigger():
Now we check that both trigger name and trigger table have database
part specified (explicitly or implicitly via current database. Note
that in latter case sp_name::m_db is already set by parser).
Table_triggers_list::create_trigger()/::add_table_for_trigger():
Simplified method/function's code since now they can assume that
sp_name::m_db is always filled now.
trigname_file_parameters:
Removed comment which is no longer true.
Diffstat (limited to 'mysql-test/t/trigger.test')
-rw-r--r-- | mysql-test/t/trigger.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index d4fa5268762..b4074897689 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -13,6 +13,8 @@ drop procedure if exists p1; # Create additional connections used through test connect (addconroot1, localhost, root,,); connect (addconroot2, localhost, root,,); +# Connection without current database set +connect (addconwithoutdb, localhost, root,,*NO-ONE*); connection default; create table t1 (i int); @@ -946,3 +948,16 @@ CALL p2(); drop procedure p2; drop table t1; +# +# Test for bug #14863 "Triggers: crash if create and there is no current +# database". We should not crash and give proper error when database for +# trigger or its table is not specified and there is no current database. +# +connection addconwithoutdb; +--error ER_NO_DB_ERROR +create trigger t1_bi before insert on test.t1 for each row set @a:=0; +--error ER_NO_DB_ERROR +create trigger test.t1_bi before insert on t1 for each row set @a:=0; +--error ER_NO_DB_ERROR +drop trigger t1_bi; +connection default; |