mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into mysql.com:/home/gluh/MySQL/Merge/5.0-opt libmysql/libmysql.c: Auto merged
This commit is contained in:
commit
6146c0c75d
59 changed files with 976 additions and 131 deletions
|
|
@ -481,7 +481,7 @@ str_to_date(a,b)
|
|||
create table t2 select str_to_date(a,b) from t1;
|
||||
describe t2;
|
||||
Field Type Null Key Default Extra
|
||||
str_to_date(a,b) binary(29) YES NULL
|
||||
str_to_date(a,b) datetime YES NULL
|
||||
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
||||
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
|
||||
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
|
||||
|
|
|
|||
|
|
@ -322,4 +322,42 @@ mod(5, cast(-2 as unsigned)) mod(5, 18446744073709551614) mod(5, -2)
|
|||
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
|
||||
pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)
|
||||
2.1359870359209e+96 2.1359870359209e+96 -32
|
||||
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
|
||||
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
|
||||
SELECT a DIV 900 y FROM t1 GROUP BY y;
|
||||
y
|
||||
22201025555
|
||||
22255916666
|
||||
SELECT DISTINCT a DIV 900 y FROM t1;
|
||||
y
|
||||
22201025555
|
||||
22255916666
|
||||
SELECT b DIV 900 y FROM t1 GROUP BY y;
|
||||
y
|
||||
0
|
||||
SELECT c DIV 900 y FROM t1 GROUP BY y;
|
||||
y
|
||||
0
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a LONGBLOB);
|
||||
INSERT INTO t1 VALUES('1'),('2'),('3');
|
||||
SELECT DISTINCT (a DIV 254576881) FROM t1;
|
||||
(a DIV 254576881)
|
||||
0
|
||||
SELECT (a DIV 254576881) FROM t1 UNION ALL
|
||||
SELECT (a DIV 254576881) FROM t1;
|
||||
(a DIV 254576881)
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a SET('a','b','c'));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
|
||||
a DIV 2
|
||||
0
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
|
|
|||
|
|
@ -185,4 +185,26 @@ ERROR 21000: Operand should contain 1 column(s)
|
|||
drop table table_26093;
|
||||
drop function func_26093_a;
|
||||
drop function func_26093_b;
|
||||
SELECT NAME_CONST('test', NOW());
|
||||
ERROR HY000: Incorrect arguments to NAME_CONST
|
||||
SELECT NAME_CONST('test', UPPER('test'));
|
||||
ERROR HY000: Incorrect arguments to NAME_CONST
|
||||
SELECT NAME_CONST('test', NULL);
|
||||
test
|
||||
NULL
|
||||
SELECT NAME_CONST('test', 1);
|
||||
test
|
||||
1
|
||||
SELECT NAME_CONST('test', -1);
|
||||
test
|
||||
-1
|
||||
SELECT NAME_CONST('test', 1.0);
|
||||
test
|
||||
1.0
|
||||
SELECT NAME_CONST('test', -1.0);
|
||||
test
|
||||
-1.0
|
||||
SELECT NAME_CONST('test', 'test');
|
||||
test
|
||||
test
|
||||
End of 5.0 tests
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ f2 datetime YES NULL
|
|||
f3 time YES NULL
|
||||
f4 time YES NULL
|
||||
f5 time YES NULL
|
||||
f6 time NO 00:00:00
|
||||
f6 time YES NULL
|
||||
f7 datetime YES NULL
|
||||
f8 date YES NULL
|
||||
f9 time YES NULL
|
||||
|
|
|
|||
|
|
@ -1027,6 +1027,15 @@ fmtddate field2
|
|||
Sep-4 12:00AM abcd
|
||||
DROP TABLE testBug8868;
|
||||
SET NAMES DEFAULT;
|
||||
CREATE TABLE t1 (
|
||||
a TIMESTAMP
|
||||
);
|
||||
INSERT INTO t1 VALUES (now()), (now());
|
||||
SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a);
|
||||
1
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
|
||||
|
|
|
|||
|
|
@ -1425,6 +1425,37 @@ CHECK TABLE t1 EXTENDED;
|
|||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
create table t1 (a geometry not null, spatial index(a));
|
||||
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
|
||||
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
|
||||
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
|
||||
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
|
||||
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
|
||||
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
|
||||
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
|
||||
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
|
||||
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
|
||||
drop table t1;
|
||||
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
|
||||
INSERT INTO t1(foo) VALUES (NULL);
|
||||
ERROR 23000: Column 'foo' cannot be null
|
||||
|
|
|
|||
|
|
@ -736,6 +736,12 @@ SELECT * FROM t1;
|
|||
a
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
|
||||
INSERT INTO `t1` VALUES ('','0000-00-00');
|
||||
select geomfromtext(col9,col89) as a from t1;
|
||||
a
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
create table t1 (s1 geometry not null,s2 char(100));
|
||||
create trigger t1_bu before update on t1 for each row set new.s1 = null;
|
||||
|
|
|
|||
|
|
@ -421,4 +421,22 @@ revoke all privileges, grant option from mysqltest_1@localhost;
|
|||
revoke all privileges, grant option from mysqltest_2@localhost;
|
||||
drop user mysqltest_1@localhost;
|
||||
drop user mysqltest_2@localhost;
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,1),(2,2);
|
||||
CREATE TABLE t2 (b INT, c INT);
|
||||
INSERT INTO t2 VALUES (1,100),(2,200);
|
||||
GRANT SELECT ON t1 TO mysqltest1@localhost;
|
||||
GRANT SELECT (b) ON t2 TO mysqltest1@localhost;
|
||||
USE db1;
|
||||
SELECT c FROM t2;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
SELECT * FROM t2;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
SELECT * FROM t1 JOIN t2 USING (b);
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
DROP TABLE db1.t1, db1.t2;
|
||||
DROP USER mysqltest1@localhost;
|
||||
DROP DATABASE db1;
|
||||
End of 5.0 tests
|
||||
|
|
|
|||
|
|
@ -1386,3 +1386,7 @@ f7 datetime NO NULL
|
|||
f8 datetime YES 2006-01-01 00:00:00
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
||||
show fields from information_schema.table_names;
|
||||
ERROR 42S02: Unknown table 'table_names' in information_schema
|
||||
show keys from information_schema.table_names;
|
||||
ERROR 42S02: Unknown table 'table_names' in information_schema
|
||||
|
|
|
|||
|
|
@ -830,3 +830,15 @@ id prev_id join_id
|
|||
3 2 0
|
||||
4 3 0
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug#30384: Having SQL_BUFFER_RESULT option in the
|
||||
# CREATE .. KEY(..) .. SELECT led to creating corrupted index.
|
||||
#
|
||||
create table t1(f1 int);
|
||||
insert into t1 values(1),(2),(3);
|
||||
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
|
||||
check table t2 extended;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 check status OK
|
||||
drop table t1,t2;
|
||||
##################################################################
|
||||
|
|
|
|||
|
|
@ -3544,5 +3544,27 @@ c1
|
|||
2
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug#29815: new option for suppressing last line of mysqldump:
|
||||
# "Dump completed on"
|
||||
#
|
||||
# --skip-dump-date:
|
||||
--
|
||||
|
||||
|
||||
|
||||
-- Dump completed
|
||||
# --dump-date:
|
||||
--
|
||||
|
||||
|
||||
|
||||
-- Dump completed on DATE
|
||||
# --dump-date (default):
|
||||
--
|
||||
|
||||
|
||||
|
||||
-- Dump completed on DATE
|
||||
#
|
||||
# End of 5.0 tests
|
||||
#
|
||||
|
|
|
|||
|
|
@ -715,3 +715,14 @@ a SUM(a)
|
|||
4 4
|
||||
NULL 14
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#31095: Unexpected NULL constant caused server crash.
|
||||
#
|
||||
create table t1(a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
select count(a) from t1 group by null with rollup;
|
||||
count(a)
|
||||
3
|
||||
3
|
||||
drop table t1;
|
||||
##############################################################
|
||||
|
|
|
|||
|
|
@ -4,6 +4,13 @@ reset master;
|
|||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
show variables like 'relay_log%';
|
||||
Variable_name Value
|
||||
relay_log MYSQLTEST_VARDIR/master-data/relay-log
|
||||
relay_log_index
|
||||
relay_log_info_file relay-log.info
|
||||
relay_log_purge ON
|
||||
relay_log_space_limit 0
|
||||
stop slave;
|
||||
change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=MASTER_PORT;
|
||||
|
|
|
|||
|
|
@ -136,3 +136,13 @@ d dt ts
|
|||
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT
|
||||
);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT str_to_date( '', a ) FROM t1;
|
||||
str_to_date( '', a )
|
||||
0000-00-00 00:00:00
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -427,3 +427,64 @@ f1
|
|||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#27216: functions with parameters of different date types may
|
||||
# return wrong type of the result.
|
||||
#
|
||||
create table t1 (f1 date, f2 datetime, f3 varchar(20));
|
||||
create table t2 as select coalesce(f1,f1) as f4 from t1;
|
||||
desc t2;
|
||||
Field Type Null Key Default Extra
|
||||
f4 date YES NULL
|
||||
create table t3 as select coalesce(f1,f2) as f4 from t1;
|
||||
desc t3;
|
||||
Field Type Null Key Default Extra
|
||||
f4 datetime YES NULL
|
||||
create table t4 as select coalesce(f2,f2) as f4 from t1;
|
||||
desc t4;
|
||||
Field Type Null Key Default Extra
|
||||
f4 datetime YES NULL
|
||||
create table t5 as select coalesce(f1,f3) as f4 from t1;
|
||||
desc t5;
|
||||
Field Type Null Key Default Extra
|
||||
f4 varbinary(20) YES NULL
|
||||
create table t6 as select coalesce(f2,f3) as f4 from t1;
|
||||
desc t6;
|
||||
Field Type Null Key Default Extra
|
||||
f4 varbinary(20) YES NULL
|
||||
create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
|
||||
desc t7;
|
||||
Field Type Null Key Default Extra
|
||||
f4 datetime YES NULL
|
||||
create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4
|
||||
from t1;
|
||||
desc t8;
|
||||
Field Type Null Key Default Extra
|
||||
f4 datetime YES NULL
|
||||
create table t9 as select case when 1 then cast('01-01-01' as date)
|
||||
when 0 then cast('01-01-01' as date) end as f4 from t1;
|
||||
desc t9;
|
||||
Field Type Null Key Default Extra
|
||||
f4 date YES NULL
|
||||
create table t10 as select case when 1 then cast('01-01-01' as datetime)
|
||||
when 0 then cast('01-01-01' as datetime) end as f4 from t1;
|
||||
desc t10;
|
||||
Field Type Null Key Default Extra
|
||||
f4 datetime YES NULL
|
||||
create table t11 as select if(1, cast('01-01-01' as datetime),
|
||||
cast('01-01-01' as date)) as f4 from t1;
|
||||
desc t11;
|
||||
Field Type Null Key Default Extra
|
||||
f4 datetime YES NULL
|
||||
create table t12 as select least(cast('01-01-01' as datetime),
|
||||
cast('01-01-01' as date)) as f4 from t1;
|
||||
desc t12;
|
||||
Field Type Null Key Default Extra
|
||||
f4 datetime YES NULL
|
||||
create table t13 as select ifnull(cast('01-01-01' as datetime),
|
||||
cast('01-01-01' as date)) as f4 from t1;
|
||||
desc t13;
|
||||
Field Type Null Key Default Extra
|
||||
f4 datetime YES NULL
|
||||
drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13;
|
||||
###################################################################
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ drop table t1;
|
|||
create table t1 (a int, b int);
|
||||
create view v1 as select a, sum(b) from t1 group by a;
|
||||
select b from v1 use index (some_index) where b=1;
|
||||
ERROR HY000: Key 'some_index' doesn't exist in table 'v1'
|
||||
ERROR HY000: Incorrect usage of USE INDEX and VIEW
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create table t1 (col1 char(5),col2 char(5));
|
||||
|
|
@ -2706,18 +2706,19 @@ CREATE TABLE t1(
|
|||
fName varchar(25) NOT NULL,
|
||||
lName varchar(25) NOT NULL,
|
||||
DOB date NOT NULL,
|
||||
test_date date NOT NULL,
|
||||
uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
||||
INSERT INTO t1(fName, lName, DOB) VALUES
|
||||
('Hank', 'Hill', '1964-09-29'),
|
||||
('Tom', 'Adams', '1908-02-14'),
|
||||
('Homer', 'Simpson', '1968-03-05');
|
||||
INSERT INTO t1(fName, lName, DOB, test_date) VALUES
|
||||
('Hank', 'Hill', '1964-09-29', '2007-01-01'),
|
||||
('Tom', 'Adams', '1908-02-14', '2007-01-01'),
|
||||
('Homer', 'Simpson', '1968-03-05', '2007-01-01');
|
||||
CREATE VIEW v1 AS
|
||||
SELECT (year(now())-year(DOB)) AS Age
|
||||
SELECT (year(test_date)-year(DOB)) AS Age
|
||||
FROM t1 HAVING Age < 75;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75)
|
||||
SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(`t1`.`test_date`) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75)
|
||||
SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75;
|
||||
Age
|
||||
43
|
||||
39
|
||||
|
|
@ -3562,4 +3563,43 @@ table_name is_updatable
|
|||
v1 NO
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT * FROM v1 USE KEY(non_existant);
|
||||
ERROR HY000: Incorrect usage of USE INDEX and VIEW
|
||||
SELECT * FROM v1 FORCE KEY(non_existant);
|
||||
ERROR HY000: Incorrect usage of FORCE INDEX and VIEW
|
||||
SELECT * FROM v1 IGNORE KEY(non_existant);
|
||||
ERROR HY000: Incorrect usage of IGNORE INDEX and VIEW
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(a), KEY (b));
|
||||
INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),();
|
||||
CREATE VIEW v1 AS SELECT * FROM t1 FORCE KEY (PRIMARY,b) ORDER BY a;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` FORCE INDEX (PRIMARY,`b`) order by `t1`.`a`
|
||||
EXPLAIN SELECT * FROM v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 15
|
||||
CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a;
|
||||
SHOW CREATE VIEW v2;
|
||||
View Create View
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` USE INDEX () order by `t1`.`a`
|
||||
EXPLAIN SELECT * FROM v2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
|
||||
CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a;
|
||||
SHOW CREATE VIEW v3;
|
||||
View Create View
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` IGNORE INDEX (`b`) order by `t1`.`a`
|
||||
EXPLAIN SELECT * FROM v3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP VIEW v3;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
|
|
|
|||
|
|
@ -776,15 +776,60 @@ GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
|
|||
GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
|
||||
GRANT SELECT ON db26813.t1 TO u26813@localhost;
|
||||
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||
ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1'
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||
ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2'
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
ALTER VIEW v3 AS SELECT f2 FROM t1;
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
SHOW CREATE VIEW v3;
|
||||
View Create View
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1`
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1`
|
||||
DROP USER u26813@localhost;
|
||||
DROP DATABASE db26813;
|
||||
#
|
||||
# Bug#29908: A user can gain additional access through the ALTER VIEW.
|
||||
#
|
||||
CREATE DATABASE mysqltest_29908;
|
||||
USE mysqltest_29908;
|
||||
CREATE TABLE t1(f1 INT, f2 INT);
|
||||
CREATE USER u29908_1@localhost;
|
||||
CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1;
|
||||
CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS
|
||||
SELECT f1 FROM t1;
|
||||
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
|
||||
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
|
||||
GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost;
|
||||
CREATE USER u29908_2@localhost;
|
||||
GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
|
||||
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
|
||||
GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
|
||||
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
SHOW CREATE VIEW v2;
|
||||
View Create View
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1`
|
||||
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f2` AS `f2` from `t1`
|
||||
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||
SHOW CREATE VIEW v2;
|
||||
View Create View
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f2` AS `f2` from `t1`
|
||||
ALTER VIEW v1 AS SELECT f1 FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
|
||||
ALTER VIEW v2 AS SELECT f1 FROM t1;
|
||||
SHOW CREATE VIEW v2;
|
||||
View Create View
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1`
|
||||
DROP USER u29908_1@localhost;
|
||||
DROP USER u29908_2@localhost;
|
||||
DROP DATABASE mysqltest_29908;
|
||||
#######################################################################
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
DROP DATABASE IF EXISTS mysqltest2;
|
||||
CREATE DATABASE mysqltest1;
|
||||
|
|
|
|||
|
|
@ -205,4 +205,29 @@ select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3);
|
|||
select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2);
|
||||
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
|
||||
|
||||
#
|
||||
# Bug #30587: mysql crashes when trying to group by TIME div NUMBER
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
|
||||
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
|
||||
SELECT a DIV 900 y FROM t1 GROUP BY y;
|
||||
SELECT DISTINCT a DIV 900 y FROM t1;
|
||||
SELECT b DIV 900 y FROM t1 GROUP BY y;
|
||||
SELECT c DIV 900 y FROM t1 GROUP BY y;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(a LONGBLOB);
|
||||
INSERT INTO t1 VALUES('1'),('2'),('3');
|
||||
SELECT DISTINCT (a DIV 254576881) FROM t1;
|
||||
SELECT (a DIV 254576881) FROM t1 UNION ALL
|
||||
SELECT (a DIV 254576881) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(a SET('a','b','c'));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
|||
|
|
@ -189,4 +189,20 @@ drop table table_26093;
|
|||
drop function func_26093_a;
|
||||
drop function func_26093_b;
|
||||
|
||||
#
|
||||
# Bug #30832: Assertion + crash with select name_const('test',now());
|
||||
#
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT NAME_CONST('test', NOW());
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT NAME_CONST('test', UPPER('test'));
|
||||
|
||||
SELECT NAME_CONST('test', NULL);
|
||||
SELECT NAME_CONST('test', 1);
|
||||
SELECT NAME_CONST('test', -1);
|
||||
SELECT NAME_CONST('test', 1.0);
|
||||
SELECT NAME_CONST('test', -1.0);
|
||||
SELECT NAME_CONST('test', 'test');
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
|
|
|||
|
|
@ -545,6 +545,16 @@ DROP TABLE testBug8868;
|
|||
|
||||
SET NAMES DEFAULT;
|
||||
|
||||
#
|
||||
# Bug #31160: MAKETIME() crashes server when returning NULL in ORDER BY using
|
||||
# filesort
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a TIMESTAMP
|
||||
);
|
||||
INSERT INTO t1 VALUES (now()), (now());
|
||||
SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a);
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #19844 time_format in Union truncates values
|
||||
|
|
|
|||
|
|
@ -797,6 +797,42 @@ UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
|
|||
CHECK TABLE t1 EXTENDED;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #30286 spatial index cause corruption and server crash!
|
||||
#
|
||||
|
||||
create table t1 (a geometry not null, spatial index(a));
|
||||
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
|
||||
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
|
||||
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
|
||||
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
|
||||
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
|
||||
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
|
||||
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
|
||||
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
|
||||
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
|
||||
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
|
||||
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
|
||||
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -431,6 +431,14 @@ INSERT INTO t1 VALUES (NULL);
|
|||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #30955 geomfromtext() crasher
|
||||
#
|
||||
CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
|
||||
INSERT INTO `t1` VALUES ('','0000-00-00');
|
||||
select geomfromtext(col9,col89) as a from t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -585,5 +585,37 @@ drop user mysqltest_1@localhost;
|
|||
drop user mysqltest_2@localhost;
|
||||
|
||||
|
||||
#
|
||||
# Bug #30468: column level privileges not respected when joining tables
|
||||
#
|
||||
CREATE DATABASE db1;
|
||||
|
||||
USE db1;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,1),(2,2);
|
||||
|
||||
CREATE TABLE t2 (b INT, c INT);
|
||||
INSERT INTO t2 VALUES (1,100),(2,200);
|
||||
|
||||
GRANT SELECT ON t1 TO mysqltest1@localhost;
|
||||
GRANT SELECT (b) ON t2 TO mysqltest1@localhost;
|
||||
|
||||
connect (conn1,localhost,mysqltest1,,);
|
||||
connection conn1;
|
||||
USE db1;
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
SELECT c FROM t2;
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
SELECT * FROM t2;
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
SELECT * FROM t1 JOIN t2 USING (b);
|
||||
|
||||
connection default;
|
||||
disconnect conn1;
|
||||
DROP TABLE db1.t1, db1.t2;
|
||||
DROP USER mysqltest1@localhost;
|
||||
DROP DATABASE db1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
|
|
|||
|
|
@ -1089,3 +1089,12 @@ show columns from t1;
|
|||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
# Bug#30079 A check for "hidden" I_S tables is flawed
|
||||
#
|
||||
--error 1109
|
||||
show fields from information_schema.table_names;
|
||||
--error 1109
|
||||
show keys from information_schema.table_names;
|
||||
|
||||
|
|
|
|||
|
|
@ -385,3 +385,15 @@ INSERT INTO t1 (prev_id) SELECT id
|
|||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#30384: Having SQL_BUFFER_RESULT option in the
|
||||
--echo # CREATE .. KEY(..) .. SELECT led to creating corrupted index.
|
||||
--echo #
|
||||
create table t1(f1 int);
|
||||
insert into t1 values(1),(2),(3);
|
||||
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
|
||||
check table t2 extended;
|
||||
drop table t1,t2;
|
||||
--echo ##################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -1576,6 +1576,23 @@ SELECT * FROM t2;
|
|||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#29815: new option for suppressing last line of mysqldump:
|
||||
--echo # "Dump completed on"
|
||||
--echo #
|
||||
|
||||
--echo # --skip-dump-date:
|
||||
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*//
|
||||
--exec $MYSQL_DUMP --skip-dump-date test
|
||||
|
||||
--echo # --dump-date:
|
||||
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
|
||||
--exec $MYSQL_DUMP --dump-date test
|
||||
|
||||
--echo # --dump-date (default):
|
||||
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
|
||||
--exec $MYSQL_DUMP test
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.0 tests
|
||||
--echo #
|
||||
|
|
|
|||
|
|
@ -358,3 +358,12 @@ SELECT * FROM (SELECT a, SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t;
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#31095: Unexpected NULL constant caused server crash.
|
||||
--echo #
|
||||
create table t1(a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
select count(a) from t1 group by null with rollup;
|
||||
drop table t1;
|
||||
--echo ##############################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
source include/master-slave.inc;
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
show variables like 'relay_log%';
|
||||
|
||||
connection slave;
|
||||
stop slave;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
|
|
|
|||
|
|
@ -136,3 +136,16 @@ insert into t1 values (9912101,9912101,9912101);
|
|||
insert into t1 values (11111,11111,11111);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #30942: select str_to_date from derived table returns varying results
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a INT
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
|
||||
SELECT str_to_date( '', a ) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -282,3 +282,41 @@ select * from t1 where f1 between 20020101 and 20070101000000;
|
|||
select * from t1 where f1 between 2002010 and 20070101000000;
|
||||
select * from t1 where f1 between 20020101 and 2007010100000;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#27216: functions with parameters of different date types may
|
||||
--echo # return wrong type of the result.
|
||||
--echo #
|
||||
create table t1 (f1 date, f2 datetime, f3 varchar(20));
|
||||
create table t2 as select coalesce(f1,f1) as f4 from t1;
|
||||
desc t2;
|
||||
create table t3 as select coalesce(f1,f2) as f4 from t1;
|
||||
desc t3;
|
||||
create table t4 as select coalesce(f2,f2) as f4 from t1;
|
||||
desc t4;
|
||||
create table t5 as select coalesce(f1,f3) as f4 from t1;
|
||||
desc t5;
|
||||
create table t6 as select coalesce(f2,f3) as f4 from t1;
|
||||
desc t6;
|
||||
create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
|
||||
desc t7;
|
||||
create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4
|
||||
from t1;
|
||||
desc t8;
|
||||
create table t9 as select case when 1 then cast('01-01-01' as date)
|
||||
when 0 then cast('01-01-01' as date) end as f4 from t1;
|
||||
desc t9;
|
||||
create table t10 as select case when 1 then cast('01-01-01' as datetime)
|
||||
when 0 then cast('01-01-01' as datetime) end as f4 from t1;
|
||||
desc t10;
|
||||
create table t11 as select if(1, cast('01-01-01' as datetime),
|
||||
cast('01-01-01' as date)) as f4 from t1;
|
||||
desc t11;
|
||||
create table t12 as select least(cast('01-01-01' as datetime),
|
||||
cast('01-01-01' as date)) as f4 from t1;
|
||||
desc t12;
|
||||
create table t13 as select ifnull(cast('01-01-01' as datetime),
|
||||
cast('01-01-01' as date)) as f4 from t1;
|
||||
desc t13;
|
||||
drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13;
|
||||
--echo ###################################################################
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ drop table t1;
|
|||
#
|
||||
create table t1 (a int, b int);
|
||||
create view v1 as select a, sum(b) from t1 group by a;
|
||||
-- error 1176
|
||||
--error ER_WRONG_USAGE
|
||||
select b from v1 use index (some_index) where b=1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
@ -2548,19 +2548,20 @@ CREATE TABLE t1(
|
|||
fName varchar(25) NOT NULL,
|
||||
lName varchar(25) NOT NULL,
|
||||
DOB date NOT NULL,
|
||||
test_date date NOT NULL,
|
||||
uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
||||
|
||||
INSERT INTO t1(fName, lName, DOB) VALUES
|
||||
('Hank', 'Hill', '1964-09-29'),
|
||||
('Tom', 'Adams', '1908-02-14'),
|
||||
('Homer', 'Simpson', '1968-03-05');
|
||||
INSERT INTO t1(fName, lName, DOB, test_date) VALUES
|
||||
('Hank', 'Hill', '1964-09-29', '2007-01-01'),
|
||||
('Tom', 'Adams', '1908-02-14', '2007-01-01'),
|
||||
('Homer', 'Simpson', '1968-03-05', '2007-01-01');
|
||||
|
||||
CREATE VIEW v1 AS
|
||||
SELECT (year(now())-year(DOB)) AS Age
|
||||
SELECT (year(test_date)-year(DOB)) AS Age
|
||||
FROM t1 HAVING Age < 75;
|
||||
SHOW CREATE VIEW v1;
|
||||
|
||||
SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
|
||||
SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75;
|
||||
SELECT * FROM v1;
|
||||
|
||||
DROP VIEW v1;
|
||||
|
|
@ -3415,5 +3416,45 @@ select table_name, is_updatable from information_schema.views
|
|||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #28701: SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing
|
||||
# invalid statements
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
--error ER_WRONG_USAGE
|
||||
SELECT * FROM v1 USE KEY(non_existant);
|
||||
--error ER_WRONG_USAGE
|
||||
SELECT * FROM v1 FORCE KEY(non_existant);
|
||||
--error ER_WRONG_USAGE
|
||||
SELECT * FROM v1 IGNORE KEY(non_existant);
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #28702: VIEWs defined with USE/FORCE KEY ignore that request
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(a), KEY (b));
|
||||
INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),();
|
||||
CREATE VIEW v1 AS SELECT * FROM t1 FORCE KEY (PRIMARY,b) ORDER BY a;
|
||||
SHOW CREATE VIEW v1;
|
||||
EXPLAIN SELECT * FROM v1;
|
||||
CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a;
|
||||
SHOW CREATE VIEW v2;
|
||||
EXPLAIN SELECT * FROM v2;
|
||||
CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a;
|
||||
SHOW CREATE VIEW v3;
|
||||
EXPLAIN SELECT * FROM v3;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP VIEW v3;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
|
|
|||
|
|
@ -1034,10 +1034,11 @@ GRANT SELECT ON db26813.t1 TO u26813@localhost;
|
|||
|
||||
connect (u1,localhost,u26813,,db26813);
|
||||
connection u1;
|
||||
--error 1142
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||
--error 1142
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
ALTER VIEW v3 AS SELECT f2 FROM t1;
|
||||
|
||||
connection root;
|
||||
|
|
@ -1047,6 +1048,51 @@ DROP USER u26813@localhost;
|
|||
DROP DATABASE db26813;
|
||||
disconnect u1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#29908: A user can gain additional access through the ALTER VIEW.
|
||||
--echo #
|
||||
connection root;
|
||||
CREATE DATABASE mysqltest_29908;
|
||||
USE mysqltest_29908;
|
||||
CREATE TABLE t1(f1 INT, f2 INT);
|
||||
CREATE USER u29908_1@localhost;
|
||||
CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1;
|
||||
CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS
|
||||
SELECT f1 FROM t1;
|
||||
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
|
||||
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
|
||||
GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost;
|
||||
CREATE USER u29908_2@localhost;
|
||||
GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
|
||||
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
|
||||
GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
|
||||
|
||||
connect (u2,localhost,u29908_2,,mysqltest_29908);
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||
SHOW CREATE VIEW v2;
|
||||
|
||||
connect (u1,localhost,u29908_1,,mysqltest_29908);
|
||||
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||
SHOW CREATE VIEW v2;
|
||||
|
||||
connection root;
|
||||
ALTER VIEW v1 AS SELECT f1 FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
ALTER VIEW v2 AS SELECT f1 FROM t1;
|
||||
SHOW CREATE VIEW v2;
|
||||
|
||||
DROP USER u29908_1@localhost;
|
||||
DROP USER u29908_2@localhost;
|
||||
DROP DATABASE mysqltest_29908;
|
||||
disconnect u1;
|
||||
disconnect u2;
|
||||
--echo #######################################################################
|
||||
|
||||
#
|
||||
# BUG#24040: Create View don't succed with "all privileges" on a database.
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue