mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
merged 5.1.29-rc into 5.1-bugteam
This commit is contained in:
@@ -1559,6 +1559,17 @@ SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 c1 1 c1 A NULL NULL NULL YES BTREE
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
|
||||
INSERT IGNORE INTO t1 (b) VALUES (5);
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
|
@@ -205,4 +205,19 @@ Warnings:
|
||||
Warning 1364 Field 'id' doesn't have a default value
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create table t1 (a int unique);
|
||||
create table t2 (b int default 10);
|
||||
insert into t1 (a) values (1);
|
||||
insert into t2 (b) values (1);
|
||||
insert into t1 (a) select b from t2 on duplicate key update a=default;
|
||||
select * from t1;
|
||||
a
|
||||
NULL
|
||||
insert into t1 (a) values (1);
|
||||
insert into t1 (a) select b from t2 on duplicate key update a=default(b);
|
||||
select * from t1;
|
||||
a
|
||||
NULL
|
||||
10
|
||||
drop table t1, t2;
|
||||
End of 5.0 tests.
|
||||
|
@@ -114,6 +114,18 @@ End of 4.1 tests
|
||||
SELECT 1 REGEXP NULL;
|
||||
1 REGEXP NULL
|
||||
NULL
|
||||
SELECT '' REGEXP BINARY NULL;
|
||||
'' REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT NULL REGEXP BINARY NULL;
|
||||
NULL REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT 'A' REGEXP BINARY NULL;
|
||||
'A' REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT "ABC" REGEXP BINARY NULL;
|
||||
"ABC" REGEXP BINARY NULL
|
||||
NULL
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1(a INT, b CHAR(4));
|
||||
INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');
|
||||
|
@@ -434,7 +434,7 @@ 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'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for 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;
|
||||
|
@@ -155,7 +155,7 @@ select "user3";
|
||||
user3
|
||||
user3
|
||||
select * from t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
select a from t1;
|
||||
a
|
||||
1
|
||||
|
@@ -155,7 +155,7 @@ select "user3";
|
||||
user3
|
||||
user3
|
||||
select * from t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
select a from t1;
|
||||
a
|
||||
1
|
||||
|
@@ -180,3 +180,21 @@ Variable_name Value
|
||||
Com_alter_function 0
|
||||
Com_create_function 1
|
||||
Com_drop_function 1
|
||||
create database db37908;
|
||||
create table db37908.t1(f1 int);
|
||||
insert into db37908.t1 values(1);
|
||||
grant usage,execute on test.* to mysqltest_1@localhost;
|
||||
create procedure proc37908() begin select 1; end |
|
||||
create function func37908() returns int sql security invoker
|
||||
return (select * from db37908.t1 limit 1)|
|
||||
select * from db37908.t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
|
||||
show status where variable_name ='uptime' and 2 in (select * from db37908.t1);
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
|
||||
show procedure status where name ='proc37908' and 1 in (select f1 from db37908.t1);
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
|
||||
show function status where name ='func37908' and 1 in (select func37908());
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
|
||||
drop database db37908;
|
||||
drop procedure proc37908;
|
||||
drop function func37908;
|
||||
|
@@ -560,6 +560,29 @@ select * from t2
|
||||
where id in (select id from t2 as x1 where (t2.cur_date is null));
|
||||
id cur_date
|
||||
drop table t1,t2;
|
||||
SELECT
|
||||
CAST('NULL' AS DATE) <=> CAST('2008-01-01' AS DATE) n1,
|
||||
CAST('2008-01-01' AS DATE) <=> CAST('NULL' AS DATE) n2,
|
||||
CAST('NULL' AS DATE) <=> CAST('NULL' AS DATE) n3,
|
||||
CAST('NULL' AS DATE) <> CAST('2008-01-01' AS DATE) n4,
|
||||
CAST('2008-01-01' AS DATE) <> CAST('NULL' AS DATE) n5,
|
||||
CAST('NULL' AS DATE) <> CAST('NULL' AS DATE) n6,
|
||||
CAST('NULL' AS DATE) < CAST('2008-01-01' AS DATE) n7,
|
||||
CAST('2008-01-01' AS DATE) < CAST('NULL' AS DATE) n8,
|
||||
CAST('NULL' AS DATE) < CAST('NULL' AS DATE) n9;
|
||||
n1 n2 n3 n4 n5 n6 n7 n8 n9
|
||||
0 0 1 NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
Warning 1292 Incorrect datetime value: 'NULL'
|
||||
End of 5.0 tests
|
||||
set @org_mode=@@sql_mode;
|
||||
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
|
||||
|
@@ -93,4 +93,14 @@ c
|
||||
1,2,3
|
||||
64
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
set_unique_utf8 set ('a','b','c','d','e','f','g','h','i','j','k','l',
|
||||
'm','n','o','p','q','r','s','t','u','v','w','x',
|
||||
'y','z') CHARACTER SET utf8,
|
||||
unique (set_unique_utf8)
|
||||
);
|
||||
INSERT INTO t1 ( set_unique_utf8 ) VALUES ( '' );
|
||||
INSERT INTO t1 ( set_unique_utf8 ) VALUES ( '' );
|
||||
ERROR 23000: Duplicate entry '' for key 'set_unique_utf8'
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@@ -957,3 +957,42 @@ Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
CREATE USER mysqluser1@localhost;
|
||||
CREATE DATABASE mysqltest1;
|
||||
USE mysqltest1;
|
||||
CREATE TABLE t1 ( a INT, b INT );
|
||||
CREATE TABLE t2 ( a INT, b INT );
|
||||
CREATE VIEW v1 AS SELECT a, b FROM t1;
|
||||
GRANT SELECT( a ) ON v1 TO mysqluser1@localhost;
|
||||
GRANT UPDATE( b ) ON t2 TO mysqluser1@localhost;
|
||||
SELECT * FROM mysqltest1.v1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
|
||||
CREATE VIEW v1 AS SELECT * FROM mysqltest1.t2;
|
||||
ERROR 42000: ANY command denied to user 'mysqluser1'@'localhost' for table 't2'
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP USER mysqluser1@localhost;
|
||||
CREATE USER mysqluser1@localhost;
|
||||
CREATE DATABASE mysqltest1;
|
||||
USE mysqltest1;
|
||||
CREATE VIEW v1 AS SELECT * FROM information_schema.tables LIMIT 1;
|
||||
CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 1 AS A;
|
||||
CREATE VIEW test.v3 AS SELECT 1 AS a;
|
||||
GRANT SELECT ON mysqltest1.* to mysqluser1@localhost;
|
||||
GRANT ALL ON test.* TO mysqluser1@localhost;
|
||||
PREPARE stmt_v1 FROM "SELECT * FROM mysqltest1.v1";
|
||||
PREPARE stmt_v2 FROM "SELECT * FROM mysqltest1.v2";
|
||||
REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost;
|
||||
EXECUTE stmt_v1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
|
||||
EXECUTE stmt_v2;
|
||||
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v2'
|
||||
PREPARE stmt FROM "SELECT a FROM v3";
|
||||
EXECUTE stmt;
|
||||
a
|
||||
1
|
||||
DROP VIEW v1, v2;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP VIEW test.v3;
|
||||
DROP USER mysqluser1@localhost;
|
||||
|
Reference in New Issue
Block a user