2003-05-23 07:55:49 +02:00
|
|
|
select database();
|
|
|
|
database()
|
|
|
|
test
|
|
|
|
select charset(database());
|
|
|
|
charset(database())
|
2021-02-14 21:09:37 +01:00
|
|
|
utf8mb3
|
2003-05-23 07:55:49 +02:00
|
|
|
select database() = "test";
|
|
|
|
database() = "test"
|
|
|
|
1
|
|
|
|
select database() = _utf8"test";
|
|
|
|
database() = _utf8"test"
|
|
|
|
1
|
|
|
|
select database() = _latin1"test";
|
|
|
|
database() = _latin1"test"
|
|
|
|
1
|
|
|
|
select user() like "%@%";
|
|
|
|
user() like "%@%"
|
|
|
|
1
|
|
|
|
select user() like _utf8"%@%";
|
|
|
|
user() like _utf8"%@%"
|
|
|
|
1
|
|
|
|
select user() like _latin1"%@%";
|
|
|
|
user() like _latin1"%@%"
|
|
|
|
1
|
|
|
|
select charset(user());
|
|
|
|
charset(user())
|
2021-02-14 21:09:37 +01:00
|
|
|
utf8mb3
|
2012-05-31 21:39:11 +02:00
|
|
|
select version()>="03.23.29";
|
|
|
|
version()>="03.23.29"
|
2003-05-23 07:55:49 +02:00
|
|
|
1
|
2012-05-31 21:39:11 +02:00
|
|
|
select version()>=_utf8"03.23.29";
|
|
|
|
version()>=_utf8"03.23.29"
|
2000-12-28 02:56:38 +01:00
|
|
|
1
|
2012-05-31 21:39:11 +02:00
|
|
|
select version()>=_latin1"03.23.29";
|
|
|
|
version()>=_latin1"03.23.29"
|
2003-05-23 07:55:49 +02:00
|
|
|
1
|
|
|
|
select charset(version());
|
|
|
|
charset(version())
|
2021-02-14 21:09:37 +01:00
|
|
|
utf8mb3
|
2003-10-30 11:57:26 +01:00
|
|
|
explain extended select database(), user();
|
2006-07-28 19:27:01 +02:00
|
|
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
|
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
2003-10-30 11:57:26 +01:00
|
|
|
Warnings:
|
2006-06-27 19:28:32 +02:00
|
|
|
Note 1003 select database() AS `database()`,user() AS `user()`
|
2006-02-26 14:11:56 +01:00
|
|
|
create table t1 (version char(60)) select database(), user(), version() as 'version';
|
2003-05-23 07:55:49 +02:00
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
2022-02-03 17:01:31 +01:00
|
|
|
`database()` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL,
|
2021-02-14 21:09:37 +01:00
|
|
|
`user()` varchar(384) CHARACTER SET utf8mb3 DEFAULT NULL,
|
2006-03-06 11:39:36 +01:00
|
|
|
`version` char(60) DEFAULT NULL
|
2003-12-10 05:31:42 +01:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
2003-05-23 07:55:49 +02:00
|
|
|
drop table t1;
|
2004-02-11 13:53:39 +01:00
|
|
|
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
|
|
|
|
charset(charset(_utf8'a')) charset(collation(_utf8'a'))
|
2021-02-14 21:09:37 +01:00
|
|
|
utf8mb3 utf8mb3
|
2004-02-11 13:53:39 +01:00
|
|
|
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
|
|
|
|
collation(charset(_utf8'a')) collation(collation(_utf8'a'))
|
2021-02-14 21:09:37 +01:00
|
|
|
utf8mb3_general_ci utf8mb3_general_ci
|
2004-02-11 13:53:39 +01:00
|
|
|
create table t1 select charset(_utf8'a'), collation(_utf8'a');
|
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
2021-02-14 21:09:37 +01:00
|
|
|
`charset(_utf8'a')` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL,
|
|
|
|
`collation(_utf8'a')` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL
|
2004-02-11 13:53:39 +01:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
|
|
drop table t1;
|
2002-11-21 01:07:14 +01:00
|
|
|
select TRUE,FALSE,NULL;
|
|
|
|
TRUE FALSE NULL
|
|
|
|
1 0 NULL
|
2005-08-08 16:09:54 +02:00
|
|
|
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;
|
type_blob.result, func_system.result, func_str.result, ctype_collate.result:
fixing test results accordingly.
func_system.test:
New test that illegal mix of collations does not happen anymore.
item_strfunc.h:
safe_charset_converter() was added for system constants.
item_strfunc.cc:
safe_charset_converter() was added for system constants.
item_func.cc, item.h, item.cc:
Bug#8291: Illegal collation mix with USER() function.
After discussion with PeterG and Serge, a new coercibility
level for "system constants" was introduced, between
COERRIBLE and IMPLICIT. Thus:
SELECT col1 = USER() FROM t1; - is done according to col1 collation.
SELECT 'string' = USER(); - is done according to USER() collation.
At the same time, "nagg" and "strong" members were removed as unused.
item_create.cc:
Version is a system constant too.
sql/item.cc:
Bug#8291: Illegal collation mix with USER() function.
After discussion with PeterG and Serge, a new coercibility
level for "system constants" was introduced, between
COERRIBLE and IMPLICIT. Thus:
SELECT col1 = USER() FROM t1; - is done according to col1 collation.
SELECT 'string' = USER(); - is done according to USER() collation.
At the same time, "nagg" and "strong" members were removed as unused.
sql/item.h:
Bug#8291: Illegal collation mix with USER() function.
After discussion with PeterG and Serge, a new coercibility
level for "system constants" was introduced, between
COERRIBLE and IMPLICIT. Thus:
SELECT col1 = USER() FROM t1; - is done according to col1 collation.
SELECT 'string' = USER(); - is done according to USER() collation.
At the same time, "nagg" and "strong" members were removed as unused.
sql/item_create.cc:
Version is a system constant too.
sql/item_func.cc:
Bug#8291: Illegal collation mix with USER() function.
After discussion with PeterG and Serge, a new coercibility
level for "system constants" was introduced, between
COERRIBLE and IMPLICIT. Thus:
SELECT col1 = USER() FROM t1; - is done according to col1 collation.
SELECT 'string' = USER(); - is done according to USER() collation.
At the same time, "nagg" and "strong" members were removed as unused.
sql/item_strfunc.cc:
safe_charset_converter() was added for system constants.
sql/item_strfunc.h:
safe_charset_converter() was added for system constants.
mysql-test/t/func_system.test:
New test that illegal mix of collations does not happen anymore.
mysql-test/r/ctype_collate.result:
fixing test results accordingly.
mysql-test/r/func_str.result:
fixing test results accordingly.
mysql-test/r/func_system.result:
fixing test results accordingly.
mysql-test/r/type_blob.result:
fixing test results accordingly.
2005-03-04 11:20:49 +01:00
|
|
|
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
|
2005-03-28 09:24:12 +02:00
|
|
|
insert into t1 values ('a');
|
|
|
|
select left(concat(a,version()),1) from t1;
|
|
|
|
left(concat(a,version()),1)
|
|
|
|
a
|
type_blob.result, func_system.result, func_str.result, ctype_collate.result:
fixing test results accordingly.
func_system.test:
New test that illegal mix of collations does not happen anymore.
item_strfunc.h:
safe_charset_converter() was added for system constants.
item_strfunc.cc:
safe_charset_converter() was added for system constants.
item_func.cc, item.h, item.cc:
Bug#8291: Illegal collation mix with USER() function.
After discussion with PeterG and Serge, a new coercibility
level for "system constants" was introduced, between
COERRIBLE and IMPLICIT. Thus:
SELECT col1 = USER() FROM t1; - is done according to col1 collation.
SELECT 'string' = USER(); - is done according to USER() collation.
At the same time, "nagg" and "strong" members were removed as unused.
item_create.cc:
Version is a system constant too.
sql/item.cc:
Bug#8291: Illegal collation mix with USER() function.
After discussion with PeterG and Serge, a new coercibility
level for "system constants" was introduced, between
COERRIBLE and IMPLICIT. Thus:
SELECT col1 = USER() FROM t1; - is done according to col1 collation.
SELECT 'string' = USER(); - is done according to USER() collation.
At the same time, "nagg" and "strong" members were removed as unused.
sql/item.h:
Bug#8291: Illegal collation mix with USER() function.
After discussion with PeterG and Serge, a new coercibility
level for "system constants" was introduced, between
COERRIBLE and IMPLICIT. Thus:
SELECT col1 = USER() FROM t1; - is done according to col1 collation.
SELECT 'string' = USER(); - is done according to USER() collation.
At the same time, "nagg" and "strong" members were removed as unused.
sql/item_create.cc:
Version is a system constant too.
sql/item_func.cc:
Bug#8291: Illegal collation mix with USER() function.
After discussion with PeterG and Serge, a new coercibility
level for "system constants" was introduced, between
COERRIBLE and IMPLICIT. Thus:
SELECT col1 = USER() FROM t1; - is done according to col1 collation.
SELECT 'string' = USER(); - is done according to USER() collation.
At the same time, "nagg" and "strong" members were removed as unused.
sql/item_strfunc.cc:
safe_charset_converter() was added for system constants.
sql/item_strfunc.h:
safe_charset_converter() was added for system constants.
mysql-test/t/func_system.test:
New test that illegal mix of collations does not happen anymore.
mysql-test/r/ctype_collate.result:
fixing test results accordingly.
mysql-test/r/func_str.result:
fixing test results accordingly.
mysql-test/r/func_system.result:
fixing test results accordingly.
mysql-test/r/type_blob.result:
fixing test results accordingly.
2005-03-04 11:20:49 +01:00
|
|
|
drop table t1;
|
2022-01-19 23:10:44 +01:00
|
|
|
#
|
|
|
|
# Start of 10.2 tests
|
|
|
|
#
|
|
|
|
|
|
|
|
MDEV-27544 database() function under UNION ALL truncates results to 34 characters
|
|
|
|
|
|
|
|
|
|
|
|
SET NAMES utf8;
|
|
|
|
create database betäubungsmittelverschreibungsverordnung;
|
|
|
|
use betäubungsmittelverschreibungsverordnung;
|
|
|
|
select database() as "database" union all select database();
|
|
|
|
database
|
|
|
|
betäubungsmittelverschreibungsverordnung
|
|
|
|
betäubungsmittelverschreibungsverordnung
|
|
|
|
drop database betäubungsmittelverschreibungsverordnung;
|
|
|
|
#
|
|
|
|
# End of 10.2 tests
|
|
|
|
#
|