diff options
author | unknown <evgen@moonbone.local> | 2005-09-15 00:08:12 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2005-09-15 00:08:12 +0400 |
commit | de4fbc212c8496f41da5d7763d5c04f379928199 (patch) | |
tree | ce99746e42c63b8d8260f384c35982901be264aa | |
parent | 528c3a71f847afe6be5bdf460be57512eada71cb (diff) | |
download | mariadb-git-de4fbc212c8496f41da5d7763d5c04f379928199.tar.gz |
Fix bug #11416 Server crash if using a view that uses function convert_tz
When parser parses function convert_tz it loads available timezone tables in
thd->lex->time_zone_tables_used. But view have another lex that main query.
Thus time_zone_tables_used of main query left uninitialized.
When Item_func_conver_tz is fixed it takes timezone tables from main query
and later when it executed it assumes that timezone tables are loaded and
failed that assertion.
sql/sql_view.cc:
Fix bug #11416 Server crash if using a view that uses function convert_tz
mysql-test/r/view.result:
Test case for bug#11416 Server crash if using a view that uses function convert_tz
mysql-test/t/view.test:
Test case for bug#11416 Server crash if using a view that uses function convert_tz
-rw-r--r-- | mysql-test/r/view.result | 5 | ||||
-rw-r--r-- | mysql-test/t/view.test | 7 | ||||
-rw-r--r-- | sql/sql_view.cc | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 038b0383639..511aeaad838 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2205,3 +2205,8 @@ select * from (select f1 as f2 from v1) v where v.f2='a'; f2 drop view v1; drop table t1; +create view v1 as SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET'); +select * from v1; +CONVERT_TZ('2004-01-01 12:00:00','GMT','MET') +NULL +drop view v1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 78eb1b07950..cd6b58519e4 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2086,3 +2086,10 @@ create view v1 as select * from t1; select * from (select f1 as f2 from v1) v where v.f2='a'; drop view v1; drop table t1; + +# +# Bug #11416 Server crash if using a view that uses function convert_tz +# +create view v1 as SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET'); +select * from v1; +drop view v1; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 5155e605ce0..c26f9cc4d71 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1069,6 +1069,8 @@ ok: ok2: if (arena) thd->restore_active_arena(arena, &backup); + if (!old_lex->time_zone_tables_used && thd->lex->time_zone_tables_used) + old_lex->time_zone_tables_used= thd->lex->time_zone_tables_used; thd->lex= old_lex; DBUG_RETURN(0); |