mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
merge
This commit is contained in:
56
mysql-test/include/ctype_common.inc
Normal file
56
mysql-test/include/ctype_common.inc
Normal file
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Common tests for all character sets and collations.
|
||||
# Include this file from a test with @test_characrer_set
|
||||
# and @test_collation set to desired values.
|
||||
#
|
||||
# Please don't use SHOW CREATE TABLE in this file,
|
||||
# we want it to be HANDLER independent. You can
|
||||
# use SHOW FULL COLUMNS instead.
|
||||
#
|
||||
# Please surround all CREATE TABLE with --disable_warnings
|
||||
# and --enable_warnings to be able to set storage_engine
|
||||
# without having to check if the hanlder exists.
|
||||
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
|
||||
#
|
||||
# Bug 1883: LIKE did not work in some cases with a key.
|
||||
#
|
||||
--disable_warnings
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
--enable_warnings
|
||||
# check the column was created with the expected charset/collation
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug 6643 incorrect response with partial utf8 index
|
||||
#
|
||||
--disable_warnings
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
--enable_warnings
|
||||
# check the column was created with the expected charset/collation
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
DROP TABLE t1;
|
||||
|
||||
DROP DATABASE d1;
|
||||
# Restore settings
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
@@ -1,10 +1,58 @@
|
||||
drop table if exists t1;
|
||||
SET NAMES big5;
|
||||
CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
|
||||
SET @test_character_set= 'big5';
|
||||
SET @test_collation= 'big5_chinese_ci';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) big5_chinese_ci YES MUL NULL select,insert,update,references
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT * FROM t1 WHERE c LIKE 'aaa%';
|
||||
c
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) big5_chinese_ci YES MUL NULL select,insert,update,references
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
|
@@ -2315,3 +2315,60 @@ HEX(CONVERT(col1 USING ucs2))
|
||||
064A06A9062F064A06AF0631
|
||||
064A06A9064A
|
||||
DROP TABLE t1;
|
||||
SET @test_character_set= 'utf8';
|
||||
SET @test_collation= 'utf8_swedish_ci';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) utf8_swedish_ci YES MUL NULL select,insert,update,references
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) utf8_swedish_ci YES MUL NULL select,insert,update,references
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
|
@@ -639,8 +639,22 @@ create table t1 (a char(10));
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
select coercibility(max(a)) from t1;
|
||||
coercibility(max(a))
|
||||
3
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (a char character set latin2);
|
||||
insert into t1 values ('a'),('b');
|
||||
select charset(max(a)), coercibility(max(a)),
|
||||
charset(min(a)), coercibility(min(a)) from t1;
|
||||
charset(max(a)) coercibility(max(a)) charset(min(a)) coercibility(min(a))
|
||||
latin2 2 latin2 2
|
||||
create table t2 select max(a),min(a) from t1;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`max(a)` char(1) character set latin2 default NULL,
|
||||
`min(a)` char(1) character set latin2 default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t2,t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
select max(a) as b from t1 having b=1;
|
||||
|
@@ -474,6 +474,12 @@ unix_timestamp(@a)
|
||||
select unix_timestamp('1969-12-01 19:00:01');
|
||||
unix_timestamp('1969-12-01 19:00:01')
|
||||
0
|
||||
select from_unixtime(0);
|
||||
from_unixtime(0)
|
||||
NULL
|
||||
select from_unixtime(2145916800);
|
||||
from_unixtime(2145916800)
|
||||
NULL
|
||||
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
|
||||
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
|
||||
SELECT * from t1;
|
||||
|
@@ -1,16 +1,16 @@
|
||||
grant all privileges on test.* to mysqltest_1@localhost;
|
||||
select * from information_schema.SCHEMATA where schema_name > 'm';
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME
|
||||
NULL mysql latin1
|
||||
NULL test latin1
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME SQL_PATH
|
||||
NULL mysql latin1 NULL
|
||||
NULL test latin1 NULL
|
||||
select schema_name from information_schema.schemata;
|
||||
schema_name
|
||||
mysql
|
||||
test
|
||||
show databases *;
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME
|
||||
NULL mysql latin1
|
||||
NULL test latin1
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME SQL_PATH
|
||||
NULL mysql latin1 NULL
|
||||
NULL test latin1 NULL
|
||||
show databases like 't%';
|
||||
Database (t%)
|
||||
test
|
||||
@@ -19,10 +19,10 @@ Database
|
||||
mysql
|
||||
test
|
||||
show databases * where schema_name like 't%';
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME
|
||||
NULL test latin1
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME SQL_PATH
|
||||
NULL test latin1 NULL
|
||||
show databases * where schema_name = 't%';
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME SQL_PATH
|
||||
create database testtets;
|
||||
create table testtets.t1(a int, b VARCHAR(30), KEY string_data (b));
|
||||
create table test.t2(a int);
|
||||
@@ -119,24 +119,24 @@ Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(64) utf8_general_ci select,insert,update,references
|
||||
select * from information_schema.COLUMNS where table_name="t1"
|
||||
and column_name= "a";
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME TYPE COLLATION_NAME IS_NULLABLE KEY COLUMN_DEFAULT EXTRA PRIVILEGES COMMENT
|
||||
NULL testtets t1 a 1 int 0 11 4 0 NULL int(11) NULL YES NULL select,insert,update,references
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
|
||||
NULL testtets t1 a 1 NULL YES int 11 11 11 0 NULL NULL int(11) select,insert,update,references
|
||||
show columns * where table_name = "t1";
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME TYPE COLLATION_NAME IS_NULLABLE KEY COLUMN_DEFAULT EXTRA PRIVILEGES COMMENT
|
||||
NULL testtets t1 a 1 int 0 11 4 0 NULL int(11) NULL YES NULL select,insert,update,references
|
||||
NULL testtets t1 b 2 varchar 30 30 30 31 latin1 varchar(30) latin1_swedish_ci YES MUL NULL select,insert,update,references
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
|
||||
NULL testtets t1 a 1 NULL YES int 11 11 11 0 NULL NULL int(11) select,insert,update,references
|
||||
NULL testtets t1 b 2 NULL YES varchar 30 30 NULL NULL latin1 latin1_swedish_ci varchar(30) MUL select,insert,update,references
|
||||
drop view v1;
|
||||
drop tables testtets.t4, testtets.t1, t2, t3;
|
||||
drop database testtets;
|
||||
select * from information_schema.CHARACTER_SETS
|
||||
where CHARACTER_SET_NAME like 'latin1%';
|
||||
CHARACTER_SET_NAME Description DEFAULT_COLLATE_NAME Maxlen
|
||||
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
|
||||
latin1 ISO 8859-1 West European latin1_swedish_ci 1
|
||||
SHOW CHARACTER SET LIKE 'latin1%';
|
||||
Charset Description Default collation Maxlen
|
||||
latin1 ISO 8859-1 West European latin1_swedish_ci 1
|
||||
SHOW CHARACTER SET * LIKE 'latin1%';
|
||||
CHARACTER_SET_NAME Description DEFAULT_COLLATE_NAME Maxlen
|
||||
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
|
||||
latin1 ISO 8859-1 West European latin1_swedish_ci 1
|
||||
SHOW CHARACTER SET WHERE CHARACTER_SET_NAME like 'latin1%';
|
||||
Charset Description Default collation Maxlen
|
||||
@@ -145,11 +145,11 @@ SHOW CHARACTER SET CHARACTER_SET_NAME WHERE CHARACTER_SET_NAME like 'latin1%';
|
||||
CHARACTER_SET_NAME
|
||||
latin1
|
||||
SHOW CHARACTER SET * WHERE CHARACTER_SET_NAME like 'latin1%';
|
||||
CHARACTER_SET_NAME Description DEFAULT_COLLATE_NAME Maxlen
|
||||
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
|
||||
latin1 ISO 8859-1 West European latin1_swedish_ci 1
|
||||
select * from information_schema.COLLATIONS
|
||||
where COLLATION_NAME like 'latin1%';
|
||||
COLLATION_NAME Charset Id Default Compiled Sortlen
|
||||
COLLATION_NAME CHARSET ID DEFAULT COMPILED SORTLEN
|
||||
latin1_german1_ci latin1 5 0
|
||||
latin1_swedish_ci latin1 8 Yes Yes 1
|
||||
latin1_danish_ci latin1 15 0
|
||||
@@ -169,7 +169,7 @@ latin1_general_ci latin1 48 0
|
||||
latin1_general_cs latin1 49 0
|
||||
latin1_spanish_ci latin1 94 0
|
||||
SHOW COLLATION * LIKE 'latin1%';
|
||||
COLLATION_NAME Charset Id Default Compiled Sortlen
|
||||
COLLATION_NAME CHARSET ID DEFAULT COMPILED SORTLEN
|
||||
latin1_german1_ci latin1 5 0
|
||||
latin1_swedish_ci latin1 8 Yes Yes 1
|
||||
latin1_danish_ci latin1 15 0
|
||||
@@ -199,7 +199,7 @@ latin1_general_ci
|
||||
latin1_general_cs
|
||||
latin1_spanish_ci
|
||||
SHOW COLLATION * WHERE COLLATION_NAME like 'latin1%';
|
||||
COLLATION_NAME Charset Id Default Compiled Sortlen
|
||||
COLLATION_NAME CHARSET ID DEFAULT COMPILED SORTLEN
|
||||
latin1_german1_ci latin1 5 0
|
||||
latin1_swedish_ci latin1 8 Yes Yes 1
|
||||
latin1_danish_ci latin1 15 0
|
||||
@@ -358,11 +358,11 @@ NULL test key_1 test t1 UNIQUE NULL
|
||||
NULL test key_2 test t1 UNIQUE NULL
|
||||
select * from information_schema.KEY_COLUMN_USAGE where
|
||||
TABLE_SCHEMA= "test";
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
|
||||
NULL test PRIMARY test t1 a 1 NULL NULL NULL
|
||||
NULL test constraint_1 test t1 a 1 NULL NULL NULL
|
||||
NULL test key_1 test t1 a 1 NULL NULL NULL
|
||||
NULL test key_2 test t1 a 1 NULL NULL NULL
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
|
||||
NULL test PRIMARY NULL test t1 a 1 NULL NULL NULL
|
||||
NULL test constraint_1 NULL test t1 a 1 NULL NULL NULL
|
||||
NULL test key_1 NULL test t1 a 1 NULL NULL NULL
|
||||
NULL test key_2 NULL test t1 a 1 NULL NULL NULL
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
|
||||
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id),
|
||||
@@ -377,11 +377,11 @@ NULL test t2_ibfk_1 test t2 FOREIGN KEY ON DELETE CASCADE
|
||||
NULL test t2_ibfk_2 test t2 FOREIGN KEY ON UPDATE CASCADE
|
||||
select * from information_schema.KEY_COLUMN_USAGE where
|
||||
TABLE_SCHEMA= "test";
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
|
||||
NULL test PRIMARY test t1 id 1 NULL NULL NULL
|
||||
NULL test PRIMARY test t2 id 1 NULL NULL NULL
|
||||
NULL test t2_ibfk_1 test t2 t1_id 1 test t1 id
|
||||
NULL test t2_ibfk_2 test t2 t1_id 1 test t1 id
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
|
||||
NULL test PRIMARY NULL test t1 id 1 NULL NULL NULL
|
||||
NULL test PRIMARY NULL test t2 id 1 NULL NULL NULL
|
||||
NULL test t2_ibfk_1 NULL test t2 t1_id 1 NULL id
|
||||
NULL test t2_ibfk_2 NULL test t2 t1_id 1 NULL id
|
||||
select table_name from information_schema.TABLES where table_schema like "test%";
|
||||
table_name
|
||||
t1
|
||||
@@ -439,6 +439,9 @@ v
|
||||
call px5()//
|
||||
v
|
||||
9
|
||||
select sql_mode from information_schema.ROUTINES;
|
||||
sql_mode
|
||||
|
||||
create table t1 (a int not null auto_increment,b int, primary key (a));
|
||||
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
||||
select AUTO_INCREMENT from information_schema.tables where table_name = 't1';
|
||||
@@ -457,32 +460,51 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS;
|
||||
Table Create Table
|
||||
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
|
||||
`CHARACTER_SET_NAME` char(30) NOT NULL default '',
|
||||
`Description` char(60) NOT NULL default '',
|
||||
`DESCRIPTION` char(60) NOT NULL default '',
|
||||
`DEFAULT_COLLATE_NAME` char(60) NOT NULL default '',
|
||||
`Maxlen` bigint(3) NOT NULL default '0'
|
||||
`MAXLEN` bigint(3) NOT NULL default '0'
|
||||
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2282
|
||||
set names latin2;
|
||||
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS;
|
||||
Table Create Table
|
||||
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
|
||||
`CHARACTER_SET_NAME` char(30) NOT NULL default '',
|
||||
`Description` char(60) NOT NULL default '',
|
||||
`DESCRIPTION` char(60) NOT NULL default '',
|
||||
`DEFAULT_COLLATE_NAME` char(60) NOT NULL default '',
|
||||
`Maxlen` bigint(3) NOT NULL default '0'
|
||||
`MAXLEN` bigint(3) NOT NULL default '0'
|
||||
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2282
|
||||
set names latin1;
|
||||
create table t1 select * from information_schema.CHARACTER_SETS
|
||||
where CHARACTER_SET_NAME like "latin1";
|
||||
select * from t1;
|
||||
CHARACTER_SET_NAME Description DEFAULT_COLLATE_NAME Maxlen
|
||||
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
|
||||
latin1 ISO 8859-1 West European latin1_swedish_ci 1
|
||||
alter table t1 default character set utf8;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`CHARACTER_SET_NAME` char(30) NOT NULL default '',
|
||||
`Description` char(60) NOT NULL default '',
|
||||
`DESCRIPTION` char(60) NOT NULL default '',
|
||||
`DEFAULT_COLLATE_NAME` char(60) NOT NULL default '',
|
||||
`Maxlen` bigint(3) NOT NULL default '0'
|
||||
`MAXLEN` bigint(3) NOT NULL default '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
drop table t1;
|
||||
create view v1 as select * from information_schema.TABLES;
|
||||
drop view v1;
|
||||
create table t1(a NUMERIC(5,3), b NUMERIC(5,1), c float(5,2),
|
||||
d NUMERIC(6,4), e float, f DECIMAL(6,3), g int(11), h DOUBLE(10,3),
|
||||
i DOUBLE);
|
||||
select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
|
||||
CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE
|
||||
from information_schema.columns where table_name= 't1';
|
||||
COLUMN_NAME COLUMN_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE
|
||||
a decimal(5,3) 7 7 5 3
|
||||
b decimal(5,1) 7 7 5 1
|
||||
c float(5,2) 5 5 5 2
|
||||
d decimal(6,4) 8 8 6 4
|
||||
e float 12 12 12 NULL
|
||||
f decimal(6,3) 8 8 6 3
|
||||
g int(11) 11 11 11 0
|
||||
h double(10,3) 10 10 10 3
|
||||
i double 22 22 22 NULL
|
||||
drop table t1;
|
||||
|
@@ -529,6 +529,7 @@ show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
|
||||
create table t2 (a int);
|
||||
set @@rand_seed1=31415926,@@rand_seed2=2718281828;
|
||||
insert t1 select * from t2;
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
|
@@ -78,9 +78,9 @@ unique key(a)
|
||||
) engine=ndb;
|
||||
insert into t1 values(1, 'aAa');
|
||||
insert into t1 values(2, 'aaa');
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
ERROR 23000: Duplicate entry '2' for key 1
|
||||
insert into t1 values(3, 'AAA');
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
ERROR 23000: Duplicate entry '3' for key 1
|
||||
select * from t1 order by p;
|
||||
p a
|
||||
1 aAa
|
||||
|
416
mysql-test/r/ndb_grant.result
Normal file
416
mysql-test/r/ndb_grant.result
Normal file
@@ -0,0 +1,416 @@
|
||||
drop table if exists t1;
|
||||
SET NAMES binary;
|
||||
use mysql;
|
||||
alter table columns_priv engine=ndb;
|
||||
alter table db engine=ndb;
|
||||
alter table func engine=ndb;
|
||||
alter table help_category engine=ndb;
|
||||
alter table help_keyword engine=ndb;
|
||||
alter table help_relation engine=ndb;
|
||||
alter table help_topic engine=ndb;
|
||||
alter table host engine=ndb;
|
||||
alter table tables_priv engine=ndb;
|
||||
alter table time_zone engine=ndb;
|
||||
alter table time_zone_leap_second engine=ndb;
|
||||
alter table time_zone_name engine=ndb;
|
||||
alter table time_zone_transition engine=ndb;
|
||||
alter table time_zone_transition_type engine=ndb;
|
||||
alter table user engine=ndb;
|
||||
use test;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
delete from mysql.db where user='mysqltest_1';
|
||||
flush privileges;
|
||||
begin;
|
||||
grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
grant delete on mysqltest.* to mysqltest_1@localhost;
|
||||
commit;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT, DELETE ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
revoke delete on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
grant select on mysqltest.* to mysqltest_1@localhost require NONE;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
begin;
|
||||
grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
|
||||
commit;
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
begin;
|
||||
grant usage on test.* to mysqltest_1@localhost with grant option;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT USAGE ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
GRANT USAGE ON `test`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
delete from mysql.db where user='mysqltest_1';
|
||||
delete from mysql.tables_priv where user='mysqltest_1';
|
||||
delete from mysql.columns_priv where user='mysqltest_1';
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host 'localhost'
|
||||
create table t1 (a int);
|
||||
begin;
|
||||
GRANT select,update,insert on t1 to mysqltest_1@localhost;
|
||||
GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, SELECT (a), INSERT, INSERT (a), UPDATE, UPDATE (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
|
||||
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
|
||||
table_priv column_priv
|
||||
Select,Insert,Update Select,Insert,Update,References
|
||||
begin;
|
||||
REVOKE select (a), update on t1 from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
GRANT select,references on t1 to mysqltest_1@localhost;
|
||||
commit;
|
||||
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
|
||||
table_priv column_priv
|
||||
Select,References References
|
||||
begin;
|
||||
grant all on test.* to mysqltest_3@localhost with grant option;
|
||||
revoke all on test.* from mysqltest_3@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_3@localhost;
|
||||
Grants for mysqltest_3@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
|
||||
GRANT USAGE ON `test`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke grant option on test.* from mysqltest_3@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_3@localhost;
|
||||
Grants for mysqltest_3@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
|
||||
begin;
|
||||
grant all on test.t1 to mysqltest_2@localhost with grant option;
|
||||
revoke all on test.t1 from mysqltest_2@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_2@localhost;
|
||||
Grants for mysqltest_2@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
|
||||
GRANT USAGE ON `test`.`t1` TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke grant option on test.t1 from mysqltest_2@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_2@localhost;
|
||||
Grants for mysqltest_2@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
|
||||
delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
flush privileges;
|
||||
drop table t1;
|
||||
begin;
|
||||
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
|
||||
ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
|
||||
commit;
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
create database mysqltest1;
|
||||
begin;
|
||||
grant usage on mysqltest1.* to test6123 identified by 'magic123';
|
||||
commit;
|
||||
select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
|
||||
host db user select_priv insert_priv
|
||||
delete from mysql.user where user='test6123';
|
||||
drop database mysqltest1;
|
||||
create table t1 (a int);
|
||||
begin;
|
||||
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
|
||||
commit;
|
||||
show grants for drop_user2@localhost;
|
||||
Grants for drop_user2@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke all privileges, grant option from drop_user2@localhost;
|
||||
commit;
|
||||
drop user drop_user2@localhost;
|
||||
begin;
|
||||
grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
|
||||
grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
|
||||
grant select(a) on test.t1 to drop_user@localhost;
|
||||
commit;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
|
||||
set sql_mode=ansi_quotes;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
|
||||
set sql_mode=default;
|
||||
set sql_quote_show_create=0;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
|
||||
set sql_mode="ansi_quotes";
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
|
||||
set sql_quote_show_create=1;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
|
||||
set sql_mode="";
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
|
||||
revoke all privileges, grant option from drop_user@localhost;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT USAGE ON *.* TO 'drop_user'@'localhost'
|
||||
drop user drop_user@localhost;
|
||||
begin;
|
||||
revoke all privileges, grant option from drop_user@localhost;
|
||||
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
|
||||
commit;
|
||||
begin;
|
||||
grant select(a) on test.t1 to drop_user1@localhost;
|
||||
commit;
|
||||
flush privileges;
|
||||
begin;
|
||||
grant select on test.t1 to drop_user2@localhost;
|
||||
grant select on test.* to drop_user3@localhost;
|
||||
grant select on *.* to drop_user4@localhost;
|
||||
commit;
|
||||
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
|
||||
drop_user4@localhost;
|
||||
ERROR HY000: Can't drop one or more of the requested users
|
||||
begin;
|
||||
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
|
||||
drop_user3@localhost, drop_user4@localhost;
|
||||
commit;
|
||||
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
|
||||
drop_user4@localhost;
|
||||
drop table t1;
|
||||
begin;
|
||||
grant usage on *.* to mysqltest_1@localhost identified by "password";
|
||||
grant select, update, insert on test.* to mysqltest@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
|
||||
drop user mysqltest_1@localhost;
|
||||
SET NAMES koi8r;
|
||||
CREATE DATABASE <20><>;
|
||||
USE <20><>;
|
||||
CREATE TABLE <20><><EFBFBD> (<28><><EFBFBD> int);
|
||||
begin;
|
||||
GRANT SELECT ON <20><>.* TO <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR <20><><EFBFBD><EFBFBD>@localhost;
|
||||
Grants for <20><><EFBFBD><EFBFBD>@localhost
|
||||
GRANT USAGE ON *.* TO '<27><><EFBFBD><EFBFBD>'@'localhost'
|
||||
GRANT SELECT ON `<60><>`.* TO '<27><><EFBFBD><EFBFBD>'@'localhost'
|
||||
begin;
|
||||
REVOKE SELECT ON <20><>.* FROM <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
begin;
|
||||
GRANT SELECT ON <20><>.<2E><><EFBFBD> TO <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR <20><><EFBFBD><EFBFBD>@localhost;
|
||||
Grants for <20><><EFBFBD><EFBFBD>@localhost
|
||||
GRANT USAGE ON *.* TO '<27><><EFBFBD><EFBFBD>'@'localhost'
|
||||
GRANT SELECT ON `<60><>`.`<60><><EFBFBD>` TO '<27><><EFBFBD><EFBFBD>'@'localhost'
|
||||
begin;
|
||||
REVOKE SELECT ON <20><>.<2E><><EFBFBD> FROM <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
begin;
|
||||
GRANT SELECT (<28><><EFBFBD>) ON <20><>.<2E><><EFBFBD> TO <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR <20><><EFBFBD><EFBFBD>@localhost;
|
||||
Grants for <20><><EFBFBD><EFBFBD>@localhost
|
||||
GRANT USAGE ON *.* TO '<27><><EFBFBD><EFBFBD>'@'localhost'
|
||||
GRANT SELECT (<28><><EFBFBD>) ON `<60><>`.`<60><><EFBFBD>` TO '<27><><EFBFBD><EFBFBD>'@'localhost'
|
||||
begin;
|
||||
REVOKE SELECT (<28><><EFBFBD>) ON <20><>.<2E><><EFBFBD> FROM <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
DROP DATABASE <20><>;
|
||||
SET NAMES latin1;
|
||||
USE test;
|
||||
CREATE TABLE t1 (a int );
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
CREATE TABLE t3 LIKE t1;
|
||||
CREATE TABLE t4 LIKE t1;
|
||||
CREATE TABLE t5 LIKE t1;
|
||||
CREATE TABLE t6 LIKE t1;
|
||||
CREATE TABLE t7 LIKE t1;
|
||||
CREATE TABLE t8 LIKE t1;
|
||||
CREATE TABLE t9 LIKE t1;
|
||||
CREATE TABLE t10 LIKE t1;
|
||||
CREATE DATABASE testdb1;
|
||||
CREATE DATABASE testdb2;
|
||||
CREATE DATABASE testdb3;
|
||||
CREATE DATABASE testdb4;
|
||||
CREATE DATABASE testdb5;
|
||||
CREATE DATABASE testdb6;
|
||||
CREATE DATABASE testdb7;
|
||||
CREATE DATABASE testdb8;
|
||||
CREATE DATABASE testdb9;
|
||||
CREATE DATABASE testdb10;
|
||||
begin;
|
||||
GRANT ALL ON testdb1.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb2.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb3.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb4.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb5.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb6.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb7.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb8.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb9.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb10.* TO testuser@localhost;
|
||||
GRANT SELECT ON test.t1 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t2 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t3 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t4 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t5 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t6 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t7 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t8 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t9 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t10 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t1 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t2 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t3 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t4 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t5 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t6 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t7 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t8 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t9 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t10 TO testuser@localhost;
|
||||
commit;
|
||||
begin;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR testuser@localhost;
|
||||
Grants for testuser@localhost
|
||||
GRANT USAGE ON *.* TO 'testuser'@'localhost'
|
||||
DROP USER testuser@localhost;
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
DROP DATABASE testdb1;
|
||||
DROP DATABASE testdb2;
|
||||
DROP DATABASE testdb3;
|
||||
DROP DATABASE testdb4;
|
||||
DROP DATABASE testdb5;
|
||||
DROP DATABASE testdb6;
|
||||
DROP DATABASE testdb7;
|
||||
DROP DATABASE testdb8;
|
||||
DROP DATABASE testdb9;
|
||||
DROP DATABASE testdb10;
|
||||
use mysql;
|
||||
alter table columns_priv engine=myisam;
|
||||
alter table db engine=myisam;
|
||||
alter table func engine=myisam;
|
||||
alter table help_category engine=myisam;
|
||||
alter table help_keyword engine=myisam;
|
||||
alter table help_relation engine=myisam;
|
||||
alter table help_topic engine=myisam;
|
||||
alter table host engine=myisam;
|
||||
alter table tables_priv engine=myisam;
|
||||
alter table time_zone engine=myisam;
|
||||
alter table time_zone_leap_second engine=myisam;
|
||||
alter table time_zone_name engine=myisam;
|
||||
alter table time_zone_transition engine=myisam;
|
||||
alter table time_zone_transition_type engine=myisam;
|
||||
alter table user engine=myisam;
|
||||
use test;
|
||||
flush privileges;
|
@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t1 values(8, 2, 3);
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
ERROR 23000: Duplicate entry '8' for key 1
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
@@ -65,7 +65,7 @@ select * from t2 where b = 4 order by a;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t2 values(8, 2, 3);
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't2'
|
||||
ERROR 23000: Duplicate entry '8' for key 1
|
||||
select * from t2 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
@@ -123,7 +123,7 @@ pk a
|
||||
3 NULL
|
||||
4 4
|
||||
insert into t1 values (5,0);
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
ERROR 23000: Duplicate entry '5' for key 1
|
||||
select * from t1 order by pk;
|
||||
pk a
|
||||
-1 NULL
|
||||
@@ -156,7 +156,7 @@ pk a b c
|
||||
0 NULL 18 NULL
|
||||
1 3 19 abc
|
||||
insert into t2 values(2,3,19,'abc');
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't2'
|
||||
ERROR 23000: Duplicate entry '2' for key 1
|
||||
select * from t2 order by pk;
|
||||
pk a b c
|
||||
-1 1 17 NULL
|
||||
|
@@ -535,27 +535,46 @@ count(*)
|
||||
2000
|
||||
insert into t1 select * from t1 where b < 10 order by pk1;
|
||||
ERROR 23000: Duplicate entry '9' for key 1
|
||||
DELETE FROM t1 WHERE pk1=2;
|
||||
begin;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3);
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
commit;
|
||||
select * from t1 where pk1=1;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
|
||||
select * from t1 where pk1 < 3 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 1 1
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3);
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
select * from t1 where pk1=1;
|
||||
2 3 4
|
||||
rollback;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
|
||||
select * from t1 where pk1 < 3 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 1 1
|
||||
REPLACE INTO t1 values(1, 2, 3);
|
||||
2 3 4
|
||||
REPLACE INTO t1 values(1, 78, 3);
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 2 3
|
||||
INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
select * from t1 where pk1=1;
|
||||
1 78 3
|
||||
INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
|
||||
select * from t1 where pk1 < 4 order by pk1;
|
||||
pk1 b c
|
||||
1 2 3
|
||||
0 0 0
|
||||
1 79 3
|
||||
2 3 4
|
||||
3 79 3
|
||||
INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
|
||||
select * from t1 where pk1 < 4 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 4 3
|
||||
2 3 4
|
||||
3 6 3
|
||||
DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
|
||||
INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
|
||||
select * from t1 where pk1 = b and b != c order by pk1;
|
||||
pk1 b c
|
||||
2 2 17
|
||||
4 4 3
|
||||
6 6 3
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT) ENGINE=ndb;
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
|
@@ -37,11 +37,10 @@ a b
|
||||
32 6
|
||||
drop table t1;
|
||||
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
|
||||
show variables like "%auto%";
|
||||
show variables like "%auto_inc%";
|
||||
Variable_name Value
|
||||
auto_increment_increment 100
|
||||
auto_increment_offset 10
|
||||
innodb_autoextend_increment 8
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
insert into t1 values (NULL),(5),(NULL);
|
||||
insert into t1 values (250),(NULL);
|
||||
|
@@ -97,13 +97,15 @@ select * from t1 where a is null or b is null;
|
||||
a b
|
||||
drop table t1;
|
||||
create table t1 (t datetime);
|
||||
insert into t1 values (20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
|
||||
insert into t1 values (20030102030460),(20030102036301),(20030102240401),
|
||||
(20030132030401),(20031302030401),(100001202030401);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 't' at row 1
|
||||
Warning 1265 Data truncated for column 't' at row 2
|
||||
Warning 1265 Data truncated for column 't' at row 3
|
||||
Warning 1265 Data truncated for column 't' at row 4
|
||||
Warning 1265 Data truncated for column 't' at row 5
|
||||
Warning 1265 Data truncated for column 't' at row 6
|
||||
select * from t1;
|
||||
t
|
||||
0000-00-00 00:00:00
|
||||
@@ -111,14 +113,18 @@ t
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
delete from t1;
|
||||
insert into t1 values ("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
|
||||
insert into t1 values
|
||||
("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
|
||||
("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
|
||||
Warnings:
|
||||
Warning 1264 Out of range value adjusted for column 't' at row 1
|
||||
Warning 1264 Out of range value adjusted for column 't' at row 2
|
||||
Warning 1264 Out of range value adjusted for column 't' at row 3
|
||||
Warning 1264 Out of range value adjusted for column 't' at row 4
|
||||
Warning 1264 Out of range value adjusted for column 't' at row 5
|
||||
Warning 1264 Out of range value adjusted for column 't' at row 6
|
||||
select * from t1;
|
||||
t
|
||||
0000-00-00 00:00:00
|
||||
@@ -126,6 +132,7 @@ t
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
delete from t1;
|
||||
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
|
||||
Warnings:
|
||||
|
@@ -1110,4 +1110,14 @@ t1 CREATE TABLE `t1` (
|
||||
`a` char(1) character set latin1 collate latin1_german1_ci default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 as
|
||||
(select a from t2) union
|
||||
(select b from t2) union
|
||||
(select 'c' collate latin1_german1_ci from t2);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(1) character set latin1 collate latin1_german1_ci default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
@@ -1646,3 +1646,18 @@ insert into v4 values (30);
|
||||
ERROR HY000: You can't specify target table 'v4' for update in FROM clause
|
||||
drop view v4, v3, v2, v1;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
create view v1 as select * from t1;
|
||||
check table t1,v1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
test.v1 check status OK
|
||||
check table v1,t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.v1 check status OK
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
check table v1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.v1 check error View 'test.v1' references invalid table(s) or column(s)
|
||||
drop view v1;
|
||||
|
@@ -7,12 +7,6 @@
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
SET NAMES big5;
|
||||
|
||||
#
|
||||
# Bug 1883: LIKE did not work in some cases with a key.
|
||||
#
|
||||
CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT * FROM t1 WHERE c LIKE 'aaa%';
|
||||
DROP TABLE t1;
|
||||
SET @test_character_set= 'big5';
|
||||
SET @test_collation= 'big5_chinese_ci';
|
||||
-- source include/ctype_common.inc
|
||||
|
@@ -435,3 +435,7 @@ INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F0646062F USING utf8));
|
||||
INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450647064506270646 USING utf8));
|
||||
SELECT HEX(CONVERT(col1 USING ucs2)) FROM t1 ORDER BY col1 COLLATE utf8_persian_ci, col1 COLLATE utf8_bin;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET @test_character_set= 'utf8';
|
||||
SET @test_collation= 'utf8_swedish_ci';
|
||||
-- source include/ctype_common.inc
|
||||
|
@@ -384,6 +384,17 @@ insert into t1 values ('a'),('b'),('c');
|
||||
select coercibility(max(a)) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #6658 MAX(column) returns incorrect coercibility
|
||||
#
|
||||
create table t1 (a char character set latin2);
|
||||
insert into t1 values ('a'),('b');
|
||||
select charset(max(a)), coercibility(max(a)),
|
||||
charset(min(a)), coercibility(min(a)) from t1;
|
||||
create table t2 select max(a),min(a) from t1;
|
||||
show create table t2;
|
||||
drop table t2,t1;
|
||||
|
||||
#
|
||||
# aggregate functions on static tables
|
||||
#
|
||||
|
@@ -229,6 +229,13 @@ select @a:=FROM_UNIXTIME(1);
|
||||
select unix_timestamp(@a);
|
||||
select unix_timestamp('1969-12-01 19:00:01');
|
||||
|
||||
#
|
||||
# Test for bug #6439 "unix_timestamp() function returns wrong datetime
|
||||
# values for too big argument". It should return error instead.
|
||||
#
|
||||
select from_unixtime(0);
|
||||
select from_unixtime(2145916800);
|
||||
|
||||
#
|
||||
# Test types from + INTERVAL
|
||||
#
|
||||
|
@@ -217,6 +217,7 @@ end;//
|
||||
call px5()//
|
||||
call px5()//
|
||||
delimiter ;//
|
||||
select sql_mode from information_schema.ROUTINES;
|
||||
|
||||
create table t1 (a int not null auto_increment,b int, primary key (a));
|
||||
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
||||
@@ -240,5 +241,14 @@ where CHARACTER_SET_NAME like "latin1";
|
||||
select * from t1;
|
||||
alter table t1 default character set utf8;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
drop table t1;
|
||||
|
||||
create view v1 as select * from information_schema.TABLES;
|
||||
drop view v1;
|
||||
create table t1(a NUMERIC(5,3), b NUMERIC(5,1), c float(5,2),
|
||||
d NUMERIC(6,4), e float, f DECIMAL(6,3), g int(11), h DOUBLE(10,3),
|
||||
i DOUBLE);
|
||||
select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
|
||||
CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE
|
||||
from information_schema.columns where table_name= 't1';
|
||||
drop table t1;
|
||||
|
@@ -498,11 +498,12 @@ alter table t1 disable keys;
|
||||
show keys from t1;
|
||||
create table t2 (a int);
|
||||
let $i=1000;
|
||||
set @@rand_seed1=31415926,@@rand_seed2=2718281828;
|
||||
--disable_query_log
|
||||
while ($i)
|
||||
{
|
||||
dec $i;
|
||||
eval insert t2 values (rand()*100000);
|
||||
insert t2 values (rand()*100000);
|
||||
}
|
||||
--enable_query_log
|
||||
insert t1 select * from t2;
|
||||
|
@@ -86,9 +86,9 @@ create table t1 (
|
||||
# ok
|
||||
insert into t1 values(1, 'aAa');
|
||||
# fail
|
||||
--error 1169
|
||||
--error 1062
|
||||
insert into t1 values(2, 'aaa');
|
||||
--error 1169
|
||||
--error 1062
|
||||
insert into t1 values(3, 'AAA');
|
||||
# 1
|
||||
select * from t1 order by p;
|
||||
|
374
mysql-test/t/ndb_grant.test
Normal file
374
mysql-test/t/ndb_grant.test
Normal file
@@ -0,0 +1,374 @@
|
||||
-- source include/have_ndb.inc
|
||||
# Test of GRANT commands
|
||||
|
||||
# Cleanup
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
SET NAMES binary;
|
||||
|
||||
#
|
||||
# Alter mysql system tables to ndb
|
||||
# make sure you alter all back in the end
|
||||
#
|
||||
use mysql;
|
||||
alter table columns_priv engine=ndb;
|
||||
alter table db engine=ndb;
|
||||
alter table func engine=ndb;
|
||||
alter table help_category engine=ndb;
|
||||
alter table help_keyword engine=ndb;
|
||||
alter table help_relation engine=ndb;
|
||||
alter table help_topic engine=ndb;
|
||||
alter table host engine=ndb;
|
||||
alter table tables_priv engine=ndb;
|
||||
alter table time_zone engine=ndb;
|
||||
alter table time_zone_leap_second engine=ndb;
|
||||
alter table time_zone_name engine=ndb;
|
||||
alter table time_zone_transition engine=ndb;
|
||||
alter table time_zone_transition_type engine=ndb;
|
||||
alter table user engine=ndb;
|
||||
use test;
|
||||
|
||||
#
|
||||
# Test that SSL options works properly
|
||||
#
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
delete from mysql.db where user='mysqltest_1';
|
||||
flush privileges;
|
||||
begin;
|
||||
grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
grant delete on mysqltest.* to mysqltest_1@localhost;
|
||||
commit;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
revoke delete on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
grant select on mysqltest.* to mysqltest_1@localhost require NONE;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
|
||||
#
|
||||
# Test that the new db privileges are stored/retrieved correctly
|
||||
#
|
||||
|
||||
begin;
|
||||
grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
|
||||
commit;
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
begin;
|
||||
grant usage on test.* to mysqltest_1@localhost with grant option;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
delete from mysql.db where user='mysqltest_1';
|
||||
delete from mysql.tables_priv where user='mysqltest_1';
|
||||
delete from mysql.columns_priv where user='mysqltest_1';
|
||||
flush privileges;
|
||||
--error 1141
|
||||
show grants for mysqltest_1@localhost;
|
||||
|
||||
#
|
||||
# Test what happens when you have same table and colum level grants
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
begin;
|
||||
GRANT select,update,insert on t1 to mysqltest_1@localhost;
|
||||
GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
|
||||
begin;
|
||||
REVOKE select (a), update on t1 from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
begin;
|
||||
GRANT select,references on t1 to mysqltest_1@localhost;
|
||||
commit;
|
||||
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
|
||||
begin;
|
||||
grant all on test.* to mysqltest_3@localhost with grant option;
|
||||
revoke all on test.* from mysqltest_3@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_3@localhost;
|
||||
begin;
|
||||
revoke grant option on test.* from mysqltest_3@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_3@localhost;
|
||||
begin;
|
||||
grant all on test.t1 to mysqltest_2@localhost with grant option;
|
||||
revoke all on test.t1 from mysqltest_2@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_2@localhost;
|
||||
begin;
|
||||
revoke grant option on test.t1 from mysqltest_2@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_2@localhost;
|
||||
delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
flush privileges;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test some error conditions
|
||||
#
|
||||
begin;
|
||||
--error 1221
|
||||
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
|
||||
commit;
|
||||
select 1; -- To test that the previous command didn't cause problems
|
||||
|
||||
#
|
||||
# Bug#6123: GRANT USAGE inserts useless Db row
|
||||
#
|
||||
create database mysqltest1;
|
||||
begin;
|
||||
grant usage on mysqltest1.* to test6123 identified by 'magic123';
|
||||
commit;
|
||||
select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
|
||||
delete from mysql.user where user='test6123';
|
||||
drop database mysqltest1;
|
||||
|
||||
#
|
||||
# Test for 'drop user', 'revoke privileges, grant'
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
begin;
|
||||
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
|
||||
commit;
|
||||
show grants for drop_user2@localhost;
|
||||
begin;
|
||||
revoke all privileges, grant option from drop_user2@localhost;
|
||||
commit;
|
||||
drop user drop_user2@localhost;
|
||||
|
||||
begin;
|
||||
grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
|
||||
grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
|
||||
grant select(a) on test.t1 to drop_user@localhost;
|
||||
commit;
|
||||
show grants for drop_user@localhost;
|
||||
|
||||
#
|
||||
# Bug3086
|
||||
#
|
||||
set sql_mode=ansi_quotes;
|
||||
show grants for drop_user@localhost;
|
||||
set sql_mode=default;
|
||||
|
||||
set sql_quote_show_create=0;
|
||||
show grants for drop_user@localhost;
|
||||
set sql_mode="ansi_quotes";
|
||||
show grants for drop_user@localhost;
|
||||
set sql_quote_show_create=1;
|
||||
show grants for drop_user@localhost;
|
||||
set sql_mode="";
|
||||
show grants for drop_user@localhost;
|
||||
|
||||
revoke all privileges, grant option from drop_user@localhost;
|
||||
show grants for drop_user@localhost;
|
||||
drop user drop_user@localhost;
|
||||
begin;
|
||||
--error 1269
|
||||
revoke all privileges, grant option from drop_user@localhost;
|
||||
commit;
|
||||
|
||||
begin;
|
||||
grant select(a) on test.t1 to drop_user1@localhost;
|
||||
commit;
|
||||
flush privileges;
|
||||
begin;
|
||||
grant select on test.t1 to drop_user2@localhost;
|
||||
grant select on test.* to drop_user3@localhost;
|
||||
grant select on *.* to drop_user4@localhost;
|
||||
commit;
|
||||
--error 1268
|
||||
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
|
||||
drop_user4@localhost;
|
||||
begin;
|
||||
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
|
||||
drop_user3@localhost, drop_user4@localhost;
|
||||
commit;
|
||||
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
|
||||
drop_user4@localhost;
|
||||
drop table t1;
|
||||
begin;
|
||||
grant usage on *.* to mysqltest_1@localhost identified by "password";
|
||||
grant select, update, insert on test.* to mysqltest@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
||||
#
|
||||
# Bug #3403 Wrong encodin in SHOW GRANTS output
|
||||
#
|
||||
SET NAMES koi8r;
|
||||
CREATE DATABASE <20><>;
|
||||
USE <20><>;
|
||||
CREATE TABLE <20><><EFBFBD> (<28><><EFBFBD> int);
|
||||
|
||||
begin;
|
||||
GRANT SELECT ON <20><>.* TO <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR <20><><EFBFBD><EFBFBD>@localhost;
|
||||
begin;
|
||||
REVOKE SELECT ON <20><>.* FROM <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
|
||||
begin;
|
||||
GRANT SELECT ON <20><>.<2E><><EFBFBD> TO <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR <20><><EFBFBD><EFBFBD>@localhost;
|
||||
begin;
|
||||
REVOKE SELECT ON <20><>.<2E><><EFBFBD> FROM <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
|
||||
begin;
|
||||
GRANT SELECT (<28><><EFBFBD>) ON <20><>.<2E><><EFBFBD> TO <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR <20><><EFBFBD><EFBFBD>@localhost;
|
||||
begin;
|
||||
REVOKE SELECT (<28><><EFBFBD>) ON <20><>.<2E><><EFBFBD> FROM <20><><EFBFBD><EFBFBD>@localhost;
|
||||
commit;
|
||||
|
||||
DROP DATABASE <20><>;
|
||||
SET NAMES latin1;
|
||||
|
||||
#
|
||||
# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
|
||||
#
|
||||
USE test;
|
||||
CREATE TABLE t1 (a int );
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
CREATE TABLE t3 LIKE t1;
|
||||
CREATE TABLE t4 LIKE t1;
|
||||
CREATE TABLE t5 LIKE t1;
|
||||
CREATE TABLE t6 LIKE t1;
|
||||
CREATE TABLE t7 LIKE t1;
|
||||
CREATE TABLE t8 LIKE t1;
|
||||
CREATE TABLE t9 LIKE t1;
|
||||
CREATE TABLE t10 LIKE t1;
|
||||
CREATE DATABASE testdb1;
|
||||
CREATE DATABASE testdb2;
|
||||
CREATE DATABASE testdb3;
|
||||
CREATE DATABASE testdb4;
|
||||
CREATE DATABASE testdb5;
|
||||
CREATE DATABASE testdb6;
|
||||
CREATE DATABASE testdb7;
|
||||
CREATE DATABASE testdb8;
|
||||
CREATE DATABASE testdb9;
|
||||
CREATE DATABASE testdb10;
|
||||
begin;
|
||||
GRANT ALL ON testdb1.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb2.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb3.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb4.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb5.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb6.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb7.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb8.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb9.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb10.* TO testuser@localhost;
|
||||
GRANT SELECT ON test.t1 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t2 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t3 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t4 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t5 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t6 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t7 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t8 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t9 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t10 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t1 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t2 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t3 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t4 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t5 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t6 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t7 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t8 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t9 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t10 TO testuser@localhost;
|
||||
commit;
|
||||
begin;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR testuser@localhost;
|
||||
DROP USER testuser@localhost;
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
DROP DATABASE testdb1;
|
||||
DROP DATABASE testdb2;
|
||||
DROP DATABASE testdb3;
|
||||
DROP DATABASE testdb4;
|
||||
DROP DATABASE testdb5;
|
||||
DROP DATABASE testdb6;
|
||||
DROP DATABASE testdb7;
|
||||
DROP DATABASE testdb8;
|
||||
DROP DATABASE testdb9;
|
||||
DROP DATABASE testdb10;
|
||||
|
||||
#
|
||||
# Alter mysql system tables back to myisam
|
||||
#
|
||||
use mysql;
|
||||
alter table columns_priv engine=myisam;
|
||||
alter table db engine=myisam;
|
||||
alter table func engine=myisam;
|
||||
alter table help_category engine=myisam;
|
||||
alter table help_keyword engine=myisam;
|
||||
alter table help_relation engine=myisam;
|
||||
alter table help_topic engine=myisam;
|
||||
alter table host engine=myisam;
|
||||
alter table tables_priv engine=myisam;
|
||||
alter table time_zone engine=myisam;
|
||||
alter table time_zone_leap_second engine=myisam;
|
||||
alter table time_zone_name engine=myisam;
|
||||
alter table time_zone_transition engine=myisam;
|
||||
alter table time_zone_transition_type engine=myisam;
|
||||
alter table user engine=myisam;
|
||||
use test;
|
||||
flush privileges;
|
@@ -21,7 +21,7 @@ select * from t1 where b = 4 order by b;
|
||||
insert into t1 values(7,8,3);
|
||||
select * from t1 where b = 4 order by a;
|
||||
|
||||
-- error 1169
|
||||
-- error 1062
|
||||
insert into t1 values(8, 2, 3);
|
||||
select * from t1 order by a;
|
||||
delete from t1 where a = 1;
|
||||
@@ -49,7 +49,7 @@ select * from t2 where c = 6;
|
||||
insert into t2 values(7,8,3);
|
||||
select * from t2 where b = 4 order by a;
|
||||
|
||||
-- error 1169
|
||||
-- error 1062
|
||||
insert into t2 values(8, 2, 3);
|
||||
select * from t2 order by a;
|
||||
delete from t2 where a = 1;
|
||||
@@ -92,7 +92,7 @@ insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
|
||||
|
||||
select * from t1 order by pk;
|
||||
|
||||
--error 1169
|
||||
--error 1062
|
||||
insert into t1 values (5,0);
|
||||
select * from t1 order by pk;
|
||||
delete from t1 where a = 0;
|
||||
@@ -111,7 +111,7 @@ insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
|
||||
|
||||
select * from t2 order by pk;
|
||||
|
||||
--error 1169
|
||||
--error 1062
|
||||
insert into t2 values(2,3,19,'abc');
|
||||
select * from t2 order by pk;
|
||||
delete from t2 where c IS NOT NULL;
|
||||
|
@@ -564,23 +564,37 @@ select count(*) from t1;
|
||||
--error 1062
|
||||
insert into t1 select * from t1 where b < 10 order by pk1;
|
||||
|
||||
DELETE FROM t1 WHERE pk1=2;
|
||||
|
||||
begin;
|
||||
--error 1031
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3);
|
||||
commit;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
|
||||
select * from t1 where pk1 < 3 order by pk1;
|
||||
rollback;
|
||||
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
|
||||
select * from t1 where pk1 < 3 order by pk1;
|
||||
|
||||
REPLACE INTO t1 values(1, 78, 3);
|
||||
select * from t1 where pk1=1;
|
||||
|
||||
--error 1031
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3);
|
||||
select * from t1 where pk1=1;
|
||||
INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
|
||||
select * from t1 where pk1 < 4 order by pk1;
|
||||
|
||||
REPLACE INTO t1 values(1, 2, 3);
|
||||
select * from t1 where pk1=1;
|
||||
INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
|
||||
select * from t1 where pk1 < 4 order by pk1;
|
||||
|
||||
--error 1031
|
||||
INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
|
||||
select * from t1 where pk1=1;
|
||||
DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
|
||||
INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
|
||||
select * from t1 where pk1 = b and b != c order by pk1;
|
||||
|
||||
# The following test case currently does not work
|
||||
#DELETE FROM t1;
|
||||
#CREATE UNIQUE INDEX bi ON t1(b);
|
||||
#INSERT INTO t1 VALUES
|
||||
#(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
#(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
#INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,c=b+10;
|
||||
#select * from t1 order by pk1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@@ -26,7 +26,7 @@ connection master;
|
||||
drop table t1;
|
||||
|
||||
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
|
||||
show variables like "%auto%";
|
||||
show variables like "%auto_inc%";
|
||||
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
|
@@ -77,10 +77,13 @@ drop table t1;
|
||||
# warnings (for both strings and numbers)
|
||||
#
|
||||
create table t1 (t datetime);
|
||||
insert into t1 values (20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
|
||||
insert into t1 values (20030102030460),(20030102036301),(20030102240401),
|
||||
(20030132030401),(20031302030401),(100001202030401);
|
||||
select * from t1;
|
||||
delete from t1;
|
||||
insert into t1 values ("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
|
||||
insert into t1 values
|
||||
("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
|
||||
("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
|
||||
select * from t1;
|
||||
delete from t1;
|
||||
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
|
||||
|
@@ -652,5 +652,11 @@ create table t1 as
|
||||
(select b collate latin1_german1_ci from t2);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
create table t1 as
|
||||
(select a from t2) union
|
||||
(select b from t2) union
|
||||
(select 'c' collate latin1_german1_ci from t2);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
|
@@ -1588,3 +1588,14 @@ create view v4 as select * from v2 where 20 < (select (s1) from t1);
|
||||
insert into v4 values (30);
|
||||
drop view v4, v3, v2, v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# CHECK TABLE with VIEW
|
||||
#
|
||||
create table t1 (a int);
|
||||
create view v1 as select * from t1;
|
||||
check table t1,v1;
|
||||
check table v1,t1;
|
||||
drop table t1;
|
||||
check table v1;
|
||||
drop view v1;
|
||||
|
Reference in New Issue
Block a user