2000-12-28 03:56:38 +02:00
|
|
|
#
|
|
|
|
# system functions
|
|
|
|
#
|
|
|
|
|
2003-05-23 10:55:49 +05:00
|
|
|
select database();
|
|
|
|
select charset(database());
|
|
|
|
select database() = "test";
|
|
|
|
select database() = _utf8"test";
|
|
|
|
select database() = _latin1"test";
|
|
|
|
|
|
|
|
select user() like "%@%";
|
|
|
|
select user() like _utf8"%@%";
|
|
|
|
select user() like _latin1"%@%";
|
|
|
|
select charset(user());
|
|
|
|
|
2012-05-31 22:39:11 +03:00
|
|
|
select version()>="03.23.29";
|
|
|
|
select version()>=_utf8"03.23.29";
|
|
|
|
select version()>=_latin1"03.23.29";
|
2003-05-23 10:55:49 +05:00
|
|
|
select charset(version());
|
2003-10-30 12:57:26 +02:00
|
|
|
explain extended select database(), user();
|
2003-05-23 10:55:49 +05:00
|
|
|
|
2006-02-26 15:11:56 +02:00
|
|
|
create table t1 (version char(60)) select database(), user(), version() as 'version';
|
2003-05-23 10:55:49 +05:00
|
|
|
show create table t1;
|
|
|
|
drop table t1;
|
|
|
|
|
2004-02-11 16:53:39 +04:00
|
|
|
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
|
|
|
|
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
|
|
|
|
create table t1 select charset(_utf8'a'), collation(_utf8'a');
|
|
|
|
show create table t1;
|
|
|
|
drop table t1;
|
|
|
|
|
2002-11-21 02:07:14 +02:00
|
|
|
select TRUE,FALSE,NULL;
|
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 14:20:49 +04:00
|
|
|
|
2005-08-08 19:09:54 +05:00
|
|
|
#
|
|
|
|
# Bug#12351: CONCAT with USER()/DATEBASE() and
|
|
|
|
# a constant and a column gets strange results
|
|
|
|
#
|
|
|
|
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;
|
|
|
|
select concat(database(), '--', c1) from t1;
|
|
|
|
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 14:20:49 +04:00
|
|
|
#
|
|
|
|
# Bug#8291 Illegal collation mix with USER() function
|
|
|
|
#
|
|
|
|
create table t1 (a char(10)) character set latin1;
|
|
|
|
select * from t1 where a=version();
|
|
|
|
select * from t1 where a=database();
|
|
|
|
select * from t1 where a=user();
|
2005-03-28 12:24:12 +05:00
|
|
|
insert into t1 values ('a');
|
|
|
|
select left(concat(a,version()),1) from 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 14:20:49 +04:00
|
|
|
drop table t1;
|
2005-07-28 03:22:47 +03:00
|
|
|
|
|
|
|
# End of 4.1 tests
|
2022-01-20 09:10:44 +11:00
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Start of 10.2 tests
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
--echo
|
|
|
|
--echo MDEV-27544 database() function under UNION ALL truncates results to 34 characters
|
|
|
|
--echo
|
|
|
|
--echo
|
|
|
|
|
2022-06-09 10:32:51 +07:00
|
|
|
--disable_service_connection
|
2022-01-20 09:10:44 +11:00
|
|
|
SET NAMES utf8;
|
|
|
|
create database betäubungsmittelverschreibungsverordnung;
|
|
|
|
use betäubungsmittelverschreibungsverordnung;
|
|
|
|
select database() as "database" union all select database();
|
|
|
|
drop database betäubungsmittelverschreibungsverordnung;
|
2022-06-09 10:32:51 +07:00
|
|
|
--enable_service_connection
|
2022-01-20 09:10:44 +11:00
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # End of 10.2 tests
|
|
|
|
--echo #
|