mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
60e411eb32
new file mysql_fix_privilege_tables.sql, mysql_create_system_tables.sh: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding. Many files: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. Adding true BINARY/VARBINARY: new pad_char structure member. ctype-bin.c: Adding true BINARY/VARBINARY: new pad_char structure member. New strnxfrm, with two trailing length bytes. field.cc: Adding true BINARY/VARBINARY. sql/field.cc: Adding true BINARY/VARBINARY. strings/ctype-big5.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-bin.c: Adding true BINARY/VARBINARY: new pad_char structure member. New strnxfrm, with two trailing length bytes. strings/ctype-cp932.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-czech.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-euc_kr.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-eucjpms.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-extra.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-gb2312.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-gbk.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-latin1.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-simple.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-sjis.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-tis620.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-uca.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-ucs2.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-ujis.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-utf8.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-win1250ch.c: Adding true BINARY/VARBINARY: new pad_char structure member. include/m_ctype.h: Adding true BINARY/VARBINARY: new pad_char structure member. mysql-test/t/alter_table.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/binary.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/cast.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ctype_cp1251.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ctype_many.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/federated.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/func_in.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ndb_condition_pushdown.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ndb_types.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/sp.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/type_blob.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/alter_table.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/binary.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/cast.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ctype_cp1251.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ctype_many.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/federated.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/func_in.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ndb_condition_pushdown.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ndb_types.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/sp.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/system_mysql_db.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/type_blob.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. scripts/mysql_create_system_tables.sh: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding. scripts/mysql_fix_privilege_tables.sql: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
227 lines
4.9 KiB
Text
227 lines
4.9 KiB
Text
drop table if exists t1;
|
||
select 1 in (1,2,3);
|
||
1 in (1,2,3)
|
||
1
|
||
select 10 in (1,2,3);
|
||
10 in (1,2,3)
|
||
0
|
||
select NULL in (1,2,3);
|
||
NULL in (1,2,3)
|
||
NULL
|
||
select 1 in (1,NULL,3);
|
||
1 in (1,NULL,3)
|
||
1
|
||
select 3 in (1,NULL,3);
|
||
3 in (1,NULL,3)
|
||
1
|
||
select 10 in (1,NULL,3);
|
||
10 in (1,NULL,3)
|
||
NULL
|
||
select 1.5 in (1.5,2.5,3.5);
|
||
1.5 in (1.5,2.5,3.5)
|
||
1
|
||
select 10.5 in (1.5,2.5,3.5);
|
||
10.5 in (1.5,2.5,3.5)
|
||
0
|
||
select NULL in (1.5,2.5,3.5);
|
||
NULL in (1.5,2.5,3.5)
|
||
NULL
|
||
select 1.5 in (1.5,NULL,3.5);
|
||
1.5 in (1.5,NULL,3.5)
|
||
1
|
||
select 3.5 in (1.5,NULL,3.5);
|
||
3.5 in (1.5,NULL,3.5)
|
||
1
|
||
select 10.5 in (1.5,NULL,3.5);
|
||
10.5 in (1.5,NULL,3.5)
|
||
NULL
|
||
CREATE TABLE t1 (a int, b int, c int);
|
||
insert into t1 values (1,2,3), (1,NULL,3);
|
||
select 1 in (a,b,c) from t1;
|
||
1 in (a,b,c)
|
||
1
|
||
1
|
||
select 3 in (a,b,c) from t1;
|
||
3 in (a,b,c)
|
||
1
|
||
1
|
||
select 10 in (a,b,c) from t1;
|
||
10 in (a,b,c)
|
||
0
|
||
NULL
|
||
select NULL in (a,b,c) from t1;
|
||
NULL in (a,b,c)
|
||
NULL
|
||
NULL
|
||
drop table t1;
|
||
CREATE TABLE t1 (a float, b float, c float);
|
||
insert into t1 values (1.5,2.5,3.5), (1.5,NULL,3.5);
|
||
select 1.5 in (a,b,c) from t1;
|
||
1.5 in (a,b,c)
|
||
1
|
||
1
|
||
select 3.5 in (a,b,c) from t1;
|
||
3.5 in (a,b,c)
|
||
1
|
||
1
|
||
select 10.5 in (a,b,c) from t1;
|
||
10.5 in (a,b,c)
|
||
0
|
||
NULL
|
||
drop table t1;
|
||
CREATE TABLE t1 (a varchar(10), b varchar(10), c varchar(10));
|
||
insert into t1 values ('A','BC','EFD'), ('A',NULL,'EFD');
|
||
select 'A' in (a,b,c) from t1;
|
||
'A' in (a,b,c)
|
||
1
|
||
1
|
||
select 'EFD' in (a,b,c) from t1;
|
||
'EFD' in (a,b,c)
|
||
1
|
||
1
|
||
select 'XSFGGHF' in (a,b,c) from t1;
|
||
'XSFGGHF' in (a,b,c)
|
||
0
|
||
NULL
|
||
drop table t1;
|
||
CREATE TABLE t1 (field char(1));
|
||
INSERT INTO t1 VALUES ('A'),(NULL);
|
||
SELECT * from t1 WHERE field IN (NULL);
|
||
field
|
||
SELECT * from t1 WHERE field NOT IN (NULL);
|
||
field
|
||
SELECT * from t1 where field = field;
|
||
field
|
||
A
|
||
SELECT * from t1 where field <=> field;
|
||
field
|
||
A
|
||
NULL
|
||
DELETE FROM t1 WHERE field NOT IN (NULL);
|
||
SELECT * FROM t1;
|
||
field
|
||
A
|
||
NULL
|
||
drop table t1;
|
||
create table t1 (id int(10) primary key);
|
||
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||
select * from t1 where id in (2,5,9);
|
||
id
|
||
2
|
||
5
|
||
9
|
||
drop table t1;
|
||
create table t1 (
|
||
a char(1) character set latin1 collate latin1_general_ci,
|
||
b char(1) character set latin1 collate latin1_swedish_ci,
|
||
c char(1) character set latin1 collate latin1_danish_ci
|
||
);
|
||
insert into t1 values ('A','B','C');
|
||
insert into t1 values ('a','c','c');
|
||
select * from t1 where a in (b);
|
||
ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
|
||
select * from t1 where a in (b,c);
|
||
ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT), (latin1_swedish_ci,IMPLICIT), (latin1_danish_ci,IMPLICIT) for operation ' IN '
|
||
select * from t1 where 'a' in (a,b,c);
|
||
ERROR HY000: Illegal mix of collations for operation ' IN '
|
||
select * from t1 where 'a' in (a);
|
||
a b c
|
||
A B C
|
||
a c c
|
||
select * from t1 where a in ('a');
|
||
a b c
|
||
A B C
|
||
a c c
|
||
select * from t1 where 'a' collate latin1_general_ci in (a,b,c);
|
||
a b c
|
||
A B C
|
||
a c c
|
||
select * from t1 where 'a' collate latin1_bin in (a,b,c);
|
||
a b c
|
||
a c c
|
||
select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||
a b c
|
||
a c c
|
||
explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||
id select_type table type possible_keys key key_len ref rows Extra
|
||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||
Warnings:
|
||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (_latin1'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin)))
|
||
drop table t1;
|
||
set names utf8;
|
||
create table t1 (a char(10) character set utf8 not null);
|
||
insert into t1 values ('bbbb'),(_koi8r'<27><><EFBFBD><EFBFBD>'),(_latin1'<27><><EFBFBD><EFBFBD>');
|
||
select a from t1 where a in ('bbbb',_koi8r'<27><><EFBFBD><EFBFBD>',_latin1'<27><><EFBFBD><EFBFBD>') order by a;
|
||
a
|
||
ÄÄÄÄ
|
||
bbbb
|
||
цццц
|
||
drop table t1;
|
||
create table t1 (a char(10) character set latin1 not null);
|
||
insert into t1 values ('a'),('b'),('c');
|
||
select a from t1 where a IN ('a','b','c') order by a;
|
||
a
|
||
a
|
||
b
|
||
c
|
||
drop table t1;
|
||
set names latin1;
|
||
select '1.0' in (1,2);
|
||
'1.0' in (1,2)
|
||
1
|
||
select 1 in ('1.0',2);
|
||
1 in ('1.0',2)
|
||
1
|
||
select 1 in (1,'2.0');
|
||
1 in (1,'2.0')
|
||
1
|
||
select 1 in ('1.0',2.0);
|
||
1 in ('1.0',2.0)
|
||
1
|
||
select 1 in (1.0,'2.0');
|
||
1 in (1.0,'2.0')
|
||
1
|
||
select 1 in ('1.1',2);
|
||
1 in ('1.1',2)
|
||
0
|
||
select 1 in ('1.1',2.0);
|
||
1 in ('1.1',2.0)
|
||
0
|
||
create table t1 (a char(2) character set binary);
|
||
insert into t1 values ('aa'), ('bb');
|
||
select * from t1 where a in (NULL, 'aa');
|
||
a
|
||
aa
|
||
drop table t1;
|
||
create table t1 (id int, key(id));
|
||
insert into t1 values (1),(2),(3);
|
||
select count(*) from t1 where id not in (1);
|
||
count(*)
|
||
2
|
||
select count(*) from t1 where id not in (1,2);
|
||
count(*)
|
||
1
|
||
drop table t1;
|
||
CREATE TABLE t1 (a int PRIMARY KEY);
|
||
INSERT INTO t1 VALUES (44), (45), (46);
|
||
SELECT * FROM t1 WHERE a IN (45);
|
||
a
|
||
45
|
||
SELECT * FROM t1 WHERE a NOT IN (0, 45);
|
||
a
|
||
44
|
||
46
|
||
SELECT * FROM t1 WHERE a NOT IN (45);
|
||
a
|
||
44
|
||
46
|
||
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a NOT IN (45);
|
||
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` from `t1` where (`t1`.`a` <> 45)
|
||
SELECT * FROM v1;
|
||
a
|
||
44
|
||
46
|
||
DROP VIEW v1;
|
||
DROP TABLE t1;
|