summaryrefslogtreecommitdiff
path: root/mysql-test/main/func_system.test
blob: d9f2bda750a5cf9560af8c0deda6ddd39577c834 (plain)
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
#
# system functions
#

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());

select version()>="03.23.29";
select version()>=_utf8"03.23.29";
select version()>=_latin1"03.23.29";
select charset(version());
explain extended select database(), user();

create table t1 (version char(60)) select database(), user(), version() as 'version';
show create table t1;
drop table t1;

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;

select TRUE,FALSE,NULL;

#
# 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;

#
# 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();
insert into t1 values ('a');
select left(concat(a,version()),1) from t1;
drop table t1;

# End of 4.1 tests

--echo #
--echo # Start of 10.2 tests
--echo #

--echo
--echo MDEV-27544 database() function under UNION ALL truncates results to 34 characters
--echo
--echo

SET NAMES utf8;
create database betäubungsmittelverschreibungsverordnung;
use betäubungsmittelverschreibungsverordnung;
select database() as "database" union all select database();
drop database betäubungsmittelverschreibungsverordnung;


--echo #
--echo # End of 10.2 tests
--echo #