File: func_system.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (91 lines) | stat: -rw-r--r-- 2,544 bytes parent folder | download
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
 #Get deafult engine value
--let $DEFAULT_ENGINE = `select @@global.default_storage_engine`

#
# system functions
#
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
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()>="3.23.29";
select version()>=_utf8"3.23.29";
select version()>=_latin1"3.23.29";
select charset(version());
explain select database(), user();

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

#Replace default engine value with static engine string 
--replace_result $DEFAULT_ENGINE ENGINE
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');

#Replace default engine value with static engine string 
--replace_result $DEFAULT_ENGINE ENGINE
show create table t1;
drop table t1;

select TRUE,FALSE,NULL;
SET sql_mode = default;
#
# 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 # Bug#25669590: regression: assertion failed: collation.collation == ...

prepare s from "DO SHA1(DATABASE());";
execute s;

--echo #
--echo # Bug#36871927: database() results truncated at 34 bytes due to union
--echo #

--error ER_TOO_LONG_IDENT
CREATE DATABASE
db345678901234567890123456789012345678901234567890123456789012345;

CREATE DATABASE
db34567890123456789012345678901234567890123456789012345678901234;

USE db34567890123456789012345678901234567890123456789012345678901234;

SELECT DATABASE();
SELECT DATABASE() UNION SELECT DATABASE();
SELECT DATABASE() UNION ALL SELECT DATABASE();

USE test;

DROP DATABASE db34567890123456789012345678901234567890123456789012345678901234;