mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into mysql.com:/home/dlenev/mysql-5.0-bg15153-2
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
drop tables if exists t1, t2;
|
||||
drop view if exists v1;
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
@ -59,3 +61,18 @@ delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
drop table t1, t2;
|
||||
create table t1 (a int, b datetime);
|
||||
insert into t1 values (1, 20010101000000), (2, 20020101000000);
|
||||
grant all privileges on test.* to mysqltest_1@localhost;
|
||||
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1;
|
||||
select * from v1;
|
||||
a lb
|
||||
1 2001-01-01 03:00:00
|
||||
2 2002-01-01 03:00:00
|
||||
select * from v1, mysql.time_zone;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone'
|
||||
drop view v1;
|
||||
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone;
|
||||
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 'time_zone'
|
||||
drop table t1;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
@ -2623,3 +2623,29 @@ select * from v1;
|
||||
ERROR HY000: Recursive stored functions and triggers are not allowed.
|
||||
drop function f1;
|
||||
drop view t1, v1;
|
||||
create table t1 (dt datetime);
|
||||
insert into t1 values (20040101000000), (20050101000000), (20060101000000);
|
||||
create view v1 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from t1;
|
||||
select * from v1;
|
||||
ldt
|
||||
2004-01-01 03:00:00
|
||||
2005-01-01 03:00:00
|
||||
2006-01-01 03:00:00
|
||||
drop view v1;
|
||||
create view v1 as select * from t1 where convert_tz(dt, 'UTC', 'Europe/Moscow') >= 20050101000000;
|
||||
select * from v1;
|
||||
dt
|
||||
2005-01-01 00:00:00
|
||||
2006-01-01 00:00:00
|
||||
create view v2 as select * from v1 where dt < 20060101000000;
|
||||
select * from v2;
|
||||
dt
|
||||
2005-01-01 00:00:00
|
||||
drop view v2;
|
||||
create view v2 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from v1;
|
||||
select * from v2;
|
||||
ldt
|
||||
2005-01-01 03:00:00
|
||||
2006-01-01 03:00:00
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
|
@ -1,6 +1,11 @@
|
||||
# Embedded server testing does not support grants
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
drop tables if exists t1, t2;
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
|
||||
# tables". We should allow implicit access to time zone description tables
|
||||
@ -82,3 +87,29 @@ flush privileges;
|
||||
drop table t1, t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Additional test for bug #15153: CONVERT_TZ() is not allowed in all
|
||||
# places in views.
|
||||
#
|
||||
# Let us check that usage of CONVERT_TZ() function in view does not
|
||||
# require additional privileges.
|
||||
|
||||
# Let us rely on that previous tests done proper cleanups
|
||||
create table t1 (a int, b datetime);
|
||||
insert into t1 values (1, 20010101000000), (2, 20020101000000);
|
||||
grant all privileges on test.* to mysqltest_1@localhost;
|
||||
connect (tzuser3, localhost, mysqltest_1,,);
|
||||
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1;
|
||||
select * from v1;
|
||||
# Of course we should not be able select from mysql.time_zone tables
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from v1, mysql.time_zone;
|
||||
drop view v1;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -2485,3 +2485,30 @@ rename table v2 to t1;
|
||||
select * from v1;
|
||||
drop function f1;
|
||||
drop view t1, v1;
|
||||
|
||||
#
|
||||
# Bug #15153: CONVERT_TZ() is not allowed in all places in VIEWs
|
||||
#
|
||||
# Error was reported when one tried to use CONVERT_TZ() function
|
||||
# select list of view which was processed using MERGE algorithm.
|
||||
# (Also see additional test in timezone_grant.test)
|
||||
create table t1 (dt datetime);
|
||||
insert into t1 values (20040101000000), (20050101000000), (20060101000000);
|
||||
# Let us test that convert_tz() can be used in view's select list
|
||||
create view v1 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from t1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
# And in its where part
|
||||
create view v1 as select * from t1 where convert_tz(dt, 'UTC', 'Europe/Moscow') >= 20050101000000;
|
||||
select * from v1;
|
||||
# Other interesting case - a view which uses convert_tz() function
|
||||
# through other view.
|
||||
create view v2 as select * from v1 where dt < 20060101000000;
|
||||
select * from v2;
|
||||
drop view v2;
|
||||
# And even more interesting case when view uses convert_tz() both
|
||||
# directly and indirectly
|
||||
create view v2 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from v1;
|
||||
select * from v2;
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user