summaryrefslogtreecommitdiff
path: root/mysql-test/r/timezone2.result
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2006-04-24 18:57:00 +0400
committerunknown <dlenev@mysql.com>2006-04-24 18:57:00 +0400
commitdfbf652165def750409cc1e8519e1aacd7a17f8b (patch)
treec4f5fbeb5dad984a88a67118b45fc15d30e0b073 /mysql-test/r/timezone2.result
parentfb62bcb0021b1ac7425e3ddfc41d6458e1f76aac (diff)
downloadmariadb-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/r/timezone2.result')
-rw-r--r--mysql-test/r/timezone2.result15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index df51a6aac9b..a1ae2f63212 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -1,4 +1,5 @@
drop table if exists t1, t2;
+drop function if exists f1;
create table t1 (ts timestamp);
set time_zone='+00:00';
select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
@@ -268,3 +269,17 @@ select * from t1;
convert_tz(NULL, NULL, NULL)
NULL
drop table t1;
+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');
+insert into t1 (ldt) values ('2006-04-19 16:30:00');
+select * from t1;
+ldt udt
+2006-04-19 16:30:00 2006-04-19 12:30:00
+select ldt, f1(udt) as ldt2 from t1;
+ldt ldt2
+2006-04-19 16:30:00 2006-04-19 16:30:00
+drop table t1;
+drop function f1;