diff options
author | unknown <dlenev@mysql.com> | 2006-04-24 18:57:00 +0400 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2006-04-24 18:57:00 +0400 |
commit | dfbf652165def750409cc1e8519e1aacd7a17f8b (patch) | |
tree | c4f5fbeb5dad984a88a67118b45fc15d30e0b073 /mysql-test/t/timezone2.test | |
parent | fb62bcb0021b1ac7425e3ddfc41d6458e1f76aac (diff) | |
download | mariadb-git-dfbf652165def750409cc1e8519e1aacd7a17f8b.tar.gz |
Fix for bug#11081 "Using a CONVERT_TZ function in a stored function or
trigger fails".
In cases when CONVERT_TZ() function was used in trigger or stored function
(or in stored procedure which was called from trigger or stored function)
error about non existing '.' table was reported.
Statements that use CONVERT_TZ() function should have time zone related
tables in their table list. tz_init_table_list() function which is used
to produce part of table list containing those tables didn't set
TABLE_LIST::db_length/table_name_length members properly. As result time
zone tables needed for CONVERT_TZ() function were incorrectly handled by
prelocking algorithm and "Table '.' doesn't exist' error was emitted.
This fix changes tz_init_table_list() in such way that it properly inits
TABLE_LIST::table_name_length/db_length members and thus produces table list
which can be handled by prelocking algorithm correctly.
mysql-test/r/timezone2.result:
Added test for bug #11081 "Using a CONVERT_TZ function in a stored function
or trigger fails".
mysql-test/t/timezone2.test:
Added test for bug #11081 "Using a CONVERT_TZ function in a stored function
or trigger fails".
sql/tztime.cc:
Now tz_init_table_list() inits table_name_length and db_length members in
TABLE_LIST objects, so table lists produced with its help can be handled
by prelocking algorithm properly.
Also two clean-ups are included:
- Now we use MY_TZ_TABLES_COUNT instead of magical number 4 in places where
it is appropriate.
- TZ_NAMES_ENTRY structure was converted to Tz_names_entry class in order
to emphasize its non-POD nature.
sql/tztime.h:
Added MY_TZ_TABLES_COUNT constant to be used as number of time zone related
tables which are needed for dynamical loading of time zone descriptions.
Diffstat (limited to 'mysql-test/t/timezone2.test')
-rw-r--r-- | mysql-test/t/timezone2.test | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test index 069c19341e4..bfc909d6995 100644 --- a/mysql-test/t/timezone2.test +++ b/mysql-test/t/timezone2.test @@ -3,6 +3,7 @@ # Preparing playground --disable_warnings drop table if exists t1, t2; +drop function if exists f1; --enable_warnings @@ -222,3 +223,22 @@ select * from t1; drop table t1; # End of 4.1 tests + +# +# Test for bug #11081 "Using a CONVERT_TZ function in a stored function +# or trigger fails". +# +create table t1 (ldt datetime, udt datetime); +create function f1(i datetime) returns datetime + return convert_tz(i, 'UTC', 'Europe/Moscow'); +create trigger t1_bi before insert on t1 for each row + set new.udt:= convert_tz(new.ldt, 'Europe/Moscow', 'UTC'); +# This should work without errors +insert into t1 (ldt) values ('2006-04-19 16:30:00'); +select * from t1; +# This should work without errors as well +select ldt, f1(udt) as ldt2 from t1; +drop table t1; +drop function f1; + +# End of 5.0 tests |