1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
select database();
database()
test
select charset(database());
charset(database())
utf8mb3
select database() = "test";
database() = "test"
1
select database() = _utf8"test";
database() = _utf8"test"
1
Warnings:
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
select database() = _latin1"test";
database() = _latin1"test"
1
select user() like "%@%";
user() like "%@%"
1
select user() like _utf8"%@%";
user() like _utf8"%@%"
1
Warnings:
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
select user() like _latin1"%@%";
user() like _latin1"%@%"
1
select charset(user());
charset(user())
utf8mb3
select version()>="3.23.29";
version()>="3.23.29"
1
select version()>=_utf8"3.23.29";
version()>=_utf8"3.23.29"
1
Warnings:
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
select version()>=_latin1"3.23.29";
version()>=_latin1"3.23.29"
1
select charset(version());
charset(version())
utf8mb3
explain select database(), user();
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 /* select#1 */ select database() AS `database()`,user() AS `user()`
create table t1 (version char(60)) select database(), user(), version() as 'version';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`database()` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL,
`user()` varchar(288) CHARACTER SET utf8mb3 NOT NULL DEFAULT '',
`version` char(60) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
charset(charset(_utf8'a')) charset(collation(_utf8'a'))
utf8mb3 utf8mb3
Warnings:
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
collation(charset(_utf8'a')) collation(collation(_utf8'a'))
utf8mb3_general_ci utf8mb3_general_ci
Warnings:
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
create table t1 select charset(_utf8'a'), collation(_utf8'a');
Warnings:
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`charset(_utf8'a')` varchar(64) CHARACTER SET utf8mb3 NOT NULL DEFAULT '',
`collation(_utf8'a')` varchar(64) CHARACTER SET utf8mb3 NOT NULL DEFAULT ''
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select TRUE,FALSE,NULL;
TRUE FALSE NULL
1 0 NULL
SET sql_mode = default;
create table t1 (c1 char(5)) character set=latin1;
insert into t1 values('row 1');
insert into t1 values('row 2');
insert into t1 values('row 3');
select concat(user(), '--', c1) from t1;
concat(user(), '--', c1)
root@localhost--row 1
root@localhost--row 2
root@localhost--row 3
select concat(database(), '--', c1) from t1;
concat(database(), '--', c1)
test--row 1
test--row 2
test--row 3
drop table t1;
create table t1 (a char(10)) character set latin1;
select * from t1 where a=version();
a
select * from t1 where a=database();
a
select * from t1 where a=user();
a
insert into t1 values ('a');
select left(concat(a,version()),1) from t1;
left(concat(a,version()),1)
a
drop table t1;
# Bug#25669590: regression: assertion failed: collation.collation == ...
prepare s from "DO SHA1(DATABASE());";
execute s;
#
# Bug#36871927: database() results truncated at 34 bytes due to union
#
CREATE DATABASE
db345678901234567890123456789012345678901234567890123456789012345;
ERROR 42000: Identifier name 'db345678901234567890123456789012345678901234567890123456789012345' is too long
CREATE DATABASE
db34567890123456789012345678901234567890123456789012345678901234;
USE db34567890123456789012345678901234567890123456789012345678901234;
SELECT DATABASE();
DATABASE()
db34567890123456789012345678901234567890123456789012345678901234
SELECT DATABASE() UNION SELECT DATABASE();
DATABASE()
db34567890123456789012345678901234567890123456789012345678901234
SELECT DATABASE() UNION ALL SELECT DATABASE();
DATABASE()
db34567890123456789012345678901234567890123456789012345678901234
db34567890123456789012345678901234567890123456789012345678901234
USE test;
DROP DATABASE db34567890123456789012345678901234567890123456789012345678901234;
|