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'')))
28
select cast(@a - @b as signed);
29
cast(@a - @b as signed)
5
31
select length(format('nan', 2)) > 0;
6
32
length(format('nan', 2)) > 0
32
58
2004-01-06 12:34:00
60
CREATE TABLE t1 (conn CHAR(7), connection_id INT);
61
INSERT INTO t1 VALUES ('default', CONNECTION_ID());
62
SELECT GET_LOCK('bug16501',600);
63
GET_LOCK('bug16501',600)
65
INSERT INTO t1 VALUES ('con1', CONNECTION_ID());
66
SELECT IS_USED_LOCK('bug16501') = connection_id
68
WHERE conn = 'default';
69
IS_USED_LOCK('bug16501') = connection_id
71
SELECT GET_LOCK('bug16501',600);
72
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
73
IS_USED_LOCK('bug16501') = CONNECTION_ID()
75
SELECT RELEASE_LOCK('bug16501');
76
RELEASE_LOCK('bug16501')
78
GET_LOCK('bug16501',600)
80
SELECT IS_USED_LOCK('bug16501') = connection_id
83
IS_USED_LOCK('bug16501') = connection_id
85
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
86
IS_USED_LOCK('bug16501') = CONNECTION_ID()
88
SELECT RELEASE_LOCK('bug16501');
89
RELEASE_LOCK('bug16501')
91
SELECT IS_USED_LOCK('bug16501');
92
IS_USED_LOCK('bug16501')
95
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
96
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
35
99
create table t1 as select uuid(), length(uuid());
36
100
show create table t1;
37
101
Table Create Table
38
102
t1 CREATE TABLE `t1` (
103
`uuid()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '',
104
`length(uuid())` int(10) NOT NULL DEFAULT '0'
105
) ENGINE=MyISAM DEFAULT CHARSET=latin1
107
create table t1 (a timestamp default '2005-05-05 01:01:01',
108
b timestamp default '2005-05-05 01:01:01');
109
insert into t1 set a = now();
113
update t1 set b = now();
114
select timediff(b, a) >= '00:00:03' from t1;
115
timediff(b, a) >= '00:00:03'
118
set global query_cache_size=1355776;
119
create table t1 (a int);
120
insert into t1 values (1),(1),(1);
121
create table t2 (a datetime default null, b datetime default null);
122
insert into t2 set a = now();
123
select a from t1 where sleep(1);
125
update t2 set b = now() where b is null;
126
insert into t2 set a = now();
127
select a from t1 where sleep(a);
129
update t2 set b = now() where b is null;
130
insert into t2 set a = now();
131
select a from t1 where sleep(1);
133
update t2 set b = now() where b is null;
134
select timediff(b, a) >= '00:00:03' from t2;
135
timediff(b, a) >= '00:00:03'
141
set global query_cache_size=default;
142
create table t1 select INET_ATON('255.255.0.1') as `a`;
143
show create table t1;
145
t1 CREATE TABLE `t1` (
146
`a` bigint(21) unsigned DEFAULT NULL
147
) ENGINE=MyISAM DEFAULT CHARSET=latin1
149
drop table if exists table_26093;
150
drop function if exists func_26093_a;
151
drop function if exists func_26093_b;
152
create table table_26093(a int);
153
insert into table_26093 values
154
(1), (2), (3), (4), (5),
155
(6), (7), (8), (9), (10);
156
create function func_26093_a(x int) returns int
158
set @invoked := @invoked + 1;
161
create function func_26093_b(x int, y int) returns int
163
set @invoked := @invoked + 1;
166
select avg(a) from table_26093;
169
select benchmark(100, (select avg(a) from table_26093));
170
benchmark(100, (select avg(a) from table_26093))
173
select benchmark(100, (select avg(func_26093_a(a)) from table_26093));
174
benchmark(100, (select avg(func_26093_a(a)) from table_26093))
180
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
181
benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093))
186
select benchmark(100, (select (a) from table_26093));
187
ERROR 21000: Subquery returns more than 1 row
188
select benchmark(100, (select 1, 1));
189
ERROR 21000: Operand should contain 1 column(s)
190
drop table table_26093;
191
drop function func_26093_a;
192
drop function func_26093_b;
193
SELECT NAME_CONST('test', NOW());
194
ERROR HY000: Incorrect arguments to NAME_CONST
195
SELECT NAME_CONST('test', UPPER('test'));
196
ERROR HY000: Incorrect arguments to NAME_CONST
197
SELECT NAME_CONST('test', NULL);
200
SELECT NAME_CONST('test', 1);
203
SELECT NAME_CONST('test', -1);
206
SELECT NAME_CONST('test', 1.0);
209
SELECT NAME_CONST('test', -1.0);
212
SELECT NAME_CONST('test', 'test');
215
CREATE TABLE t1 (a INT);
216
INSERT INTO t1 VALUES (1),(2),(3);
217
SELECT NAME_CONST('flag',1) * MAX(a) FROM t1;
218
NAME_CONST('flag',1) * MAX(a)
220
SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1;
221
NAME_CONST('flag',1.5) * MAX(a)
223
SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1;
224
NAME_CONST('flag',-1) * MAX(a)
226
SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1;
227
NAME_CONST('flag',-1.5) * MAX(a)
229
SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1;
230
ERROR HY000: Incorrect arguments to NAME_CONST
231
SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
232
ERROR HY000: Incorrect arguments to NAME_CONST
234
CREATE TABLE t1 (a int);
235
INSERT INTO t1 VALUES (5), (2);
236
SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
237
ERROR HY000: Incorrect arguments to NAME_CONST
239
CREATE TABLE t1(a INT);
240
INSERT INTO t1 VALUES (), (), ();
241
SELECT NAME_CONST(a, '1') FROM t1;
242
ERROR HY000: Incorrect arguments to NAME_CONST
243
SET INSERT_ID= NAME_CONST(a, a);
244
ERROR HY000: Incorrect arguments to NAME_CONST
246
create table t1 (a int not null);
247
insert into t1 values (-1), (-2);
248
select min(a) from t1 group by inet_ntoa(a);
252
SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
253
NAME_CONST('var', 'value') COLLATE latin1_general_cs
44
256
select connection_id() > 0;
45
257
connection_id() > 0