2
2
select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.55555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
3
3
format(1.5555,0) format(123.5555,1) format(1234.5555,2) format(12345.55555,3) format(123456.5555,4) format(1234567.5555,5) format("12345.2399",2)
4
4
2 123.6 1,234.56 12,345.556 123,456.5555 1,234,567.55550 12,345.24
5
select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
6
inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
8
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
9
inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
10
1099511627775 4294902271 65791
11
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
12
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
13
NULL 255.255.1.255 0.0.1.255
14
select hex(inet_aton('127'));
17
select hex(inet_aton('127.1'));
18
hex(inet_aton('127.1'))
20
select hex(inet_aton('127.1.1'));
21
hex(inet_aton('127.1.1'))
23
select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
24
length(uuid()) charset(uuid()) length(unhex(replace(uuid(),_utf8'-',_utf8'')))
5
26
select length(format('nan', 2)) > 0;
6
27
length(format('nan', 2)) > 0
32
53
2004-01-06 12:34:00
55
CREATE TABLE t1 (conn CHAR(7), connection_id INT);
56
INSERT INTO t1 VALUES ('default', CONNECTION_ID());
57
SELECT GET_LOCK('bug16501',600);
58
GET_LOCK('bug16501',600)
60
INSERT INTO t1 VALUES ('con1', CONNECTION_ID());
61
SELECT IS_USED_LOCK('bug16501') = connection_id
63
WHERE conn = 'default';
64
IS_USED_LOCK('bug16501') = connection_id
66
SELECT GET_LOCK('bug16501',600);
67
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
68
IS_USED_LOCK('bug16501') = CONNECTION_ID()
70
SELECT RELEASE_LOCK('bug16501');
71
RELEASE_LOCK('bug16501')
73
GET_LOCK('bug16501',600)
75
SELECT IS_USED_LOCK('bug16501') = connection_id
78
IS_USED_LOCK('bug16501') = connection_id
80
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
81
IS_USED_LOCK('bug16501') = CONNECTION_ID()
83
SELECT RELEASE_LOCK('bug16501');
84
RELEASE_LOCK('bug16501')
86
SELECT IS_USED_LOCK('bug16501');
87
IS_USED_LOCK('bug16501')
90
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
91
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
35
94
create table t1 as select uuid(), length(uuid());
36
95
show create table t1;
38
97
t1 CREATE TABLE `t1` (
98
`uuid()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '',
99
`length(uuid())` int(10) NOT NULL DEFAULT '0'
100
) ENGINE=MyISAM DEFAULT CHARSET=latin1
102
create table t1 (a timestamp default '2005-05-05 01:01:01',
103
b timestamp default '2005-05-05 01:01:01');
104
insert into t1 set a = now();
108
update t1 set b = now();
109
select timediff(b, a) >= '00:00:03' from t1;
110
timediff(b, a) >= '00:00:03'
113
set global query_cache_size=1355776;
114
create table t1 (a int);
115
insert into t1 values (1),(1),(1);
116
create table t2 (a datetime default null, b datetime default null);
117
insert into t2 set a = now();
118
select a from t1 where sleep(1);
120
update t2 set b = now() where b is null;
121
insert into t2 set a = now();
122
select a from t1 where sleep(a);
124
update t2 set b = now() where b is null;
125
insert into t2 set a = now();
126
select a from t1 where sleep(1);
128
update t2 set b = now() where b is null;
129
select timediff(b, a) >= '00:00:03' from t2;
130
timediff(b, a) >= '00:00:03'
136
set global query_cache_size=default;
137
create table t1 select INET_ATON('255.255.0.1') as `a`;
138
show create table t1;
140
t1 CREATE TABLE `t1` (
141
`a` bigint(21) unsigned DEFAULT NULL
142
) ENGINE=MyISAM DEFAULT CHARSET=latin1
144
drop table if exists table_26093;
145
drop function if exists func_26093_a;
146
drop function if exists func_26093_b;
147
create table table_26093(a int);
148
insert into table_26093 values
149
(1), (2), (3), (4), (5),
150
(6), (7), (8), (9), (10);
151
create function func_26093_a(x int) returns int
153
set @invoked := @invoked + 1;
156
create function func_26093_b(x int, y int) returns int
158
set @invoked := @invoked + 1;
161
select avg(a) from table_26093;
164
select benchmark(100, (select avg(a) from table_26093));
165
benchmark(100, (select avg(a) from table_26093))
168
select benchmark(100, (select avg(func_26093_a(a)) from table_26093));
169
benchmark(100, (select avg(func_26093_a(a)) from table_26093))
175
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
176
benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093))
181
select benchmark(100, (select (a) from table_26093));
182
ERROR 21000: Subquery returns more than 1 row
183
select benchmark(100, (select 1, 1));
184
ERROR 21000: Operand should contain 1 column(s)
185
drop table table_26093;
186
drop function func_26093_a;
187
drop function func_26093_b;
188
SELECT NAME_CONST('test', NOW());
189
ERROR HY000: Incorrect arguments to NAME_CONST
190
SELECT NAME_CONST('test', UPPER('test'));
191
ERROR HY000: Incorrect arguments to NAME_CONST
192
SELECT NAME_CONST('test', NULL);
195
SELECT NAME_CONST('test', 1);
198
SELECT NAME_CONST('test', -1);
201
SELECT NAME_CONST('test', 1.0);
204
SELECT NAME_CONST('test', -1.0);
207
SELECT NAME_CONST('test', 'test');
210
CREATE TABLE t1 (a INT);
211
INSERT INTO t1 VALUES (1),(2),(3);
212
SELECT NAME_CONST('flag',1) * MAX(a) FROM t1;
213
NAME_CONST('flag',1) * MAX(a)
215
SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1;
216
NAME_CONST('flag',1.5) * MAX(a)
218
SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1;
219
NAME_CONST('flag',-1) * MAX(a)
221
SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1;
222
NAME_CONST('flag',-1.5) * MAX(a)
224
SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1;
225
ERROR HY000: Incorrect arguments to NAME_CONST
226
SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
227
ERROR HY000: Incorrect arguments to NAME_CONST
229
CREATE TABLE t1 (a int);
230
INSERT INTO t1 VALUES (5), (2);
231
SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
232
ERROR HY000: Incorrect arguments to NAME_CONST
234
CREATE TABLE t1(a INT);
235
INSERT INTO t1 VALUES (), (), ();
236
SELECT NAME_CONST(a, '1') FROM t1;
237
ERROR HY000: Incorrect arguments to NAME_CONST
238
SET INSERT_ID= NAME_CONST(a, a);
239
ERROR HY000: Incorrect arguments to NAME_CONST
241
create table t1 (a int not null);
242
insert into t1 values (-1), (-2);
243
select min(a) from t1 group by inet_ntoa(a);
247
SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
248
NAME_CONST('var', 'value') COLLATE latin1_general_cs
44
251
select connection_id() > 0;
45
252
connection_id() > 0