mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-limit-4.1 mysql-test/r/subselect.result: Auto merged mysql-test/t/subselect.test: Auto merged sql/sql_parse.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/sql_lex.cc: Auto merged
This commit is contained in:
@ -24,6 +24,12 @@ Note 1003 select high_priority ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as
|
||||
select cast(5 as unsigned) -6.0;
|
||||
cast(5 as unsigned) -6.0
|
||||
-1.0
|
||||
select cast(NULL as signed), cast(1/0 as signed);
|
||||
cast(NULL as signed) cast(1/0 as signed)
|
||||
NULL NULL
|
||||
select cast(NULL as unsigned), cast(1/0 as unsigned);
|
||||
cast(NULL as unsigned) cast(1/0 as unsigned)
|
||||
NULL NULL
|
||||
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
|
||||
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
|
||||
0 1
|
||||
@ -36,6 +42,21 @@ cast("1:2:3" as TIME)
|
||||
select CONVERT("2004-01-22 21:45:33",DATE);
|
||||
CONVERT("2004-01-22 21:45:33",DATE)
|
||||
2004-01-22
|
||||
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
|
||||
CONVERT(DATE "2004-01-22 21:45:33" USING latin1)
|
||||
2004-01-22 21:45:33
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
|
||||
CONVERT(DATE "2004-01-22 21:45:33",CHAR)
|
||||
2004-01-22 21:45:33
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
|
||||
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4))
|
||||
2004
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
|
||||
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY)
|
||||
2004
|
||||
select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
|
||||
CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY)
|
||||
2004
|
||||
set names binary;
|
||||
select cast(_latin1'test' as char character set latin2);
|
||||
cast(_latin1'test' as char character set latin2)
|
||||
|
@ -340,129 +340,6 @@ CYR CAPIT SOFT SIGN
|
||||
CYR CAPIT E <09> <09>
|
||||
CYR CAPIT YU <09> <09>
|
||||
CYR CAPIT YA <09> <09>
|
||||
select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||
CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci') comment
|
||||
a LAT SMALL A
|
||||
b LAT SMALL B
|
||||
c LAT SMALL C
|
||||
d LAT SMALL D
|
||||
e LAT SMALL E
|
||||
f LAT SMALL F
|
||||
g LAT SMALL G
|
||||
h LAT SMALL H
|
||||
i LAT SMALL I
|
||||
j LAT SMALL J
|
||||
k LAT SMALL K
|
||||
l LAT SMALL L
|
||||
m LAT SMALL M
|
||||
n LAT SMALL N
|
||||
o LAT SMALL O
|
||||
p LAT SMALL P
|
||||
q LAT SMALL Q
|
||||
r LAT SMALL R
|
||||
s LAT SMALL S
|
||||
t LAT SMALL T
|
||||
u LAT SMALL U
|
||||
v LAT SMALL V
|
||||
w LAT SMALL W
|
||||
x LAT SMALL X
|
||||
y LAT SMALL Y
|
||||
z LAT SMALL Z
|
||||
A LAT CAPIT A
|
||||
B LAT CAPIT B
|
||||
C LAT CAPIT C
|
||||
D LAT CAPIT D
|
||||
E LAT CAPIT E
|
||||
F LAT CAPIT F
|
||||
G LAT CAPIT G
|
||||
H LAT CAPIT H
|
||||
I LAT CAPIT I
|
||||
J LAT CAPIT J
|
||||
K LAT CAPIT K
|
||||
L LAT CAPIT L
|
||||
M LAT CAPIT M
|
||||
N LAT CAPIT N
|
||||
O LAT CAPIT O
|
||||
P LAT CAPIT P
|
||||
Q LAT CAPIT Q
|
||||
R LAT CAPIT R
|
||||
S LAT CAPIT S
|
||||
T LAT CAPIT T
|
||||
U LAT CAPIT U
|
||||
V LAT CAPIT V
|
||||
W LAT CAPIT W
|
||||
X LAT CAPIT X
|
||||
Y LAT CAPIT Y
|
||||
Z LAT CAPIT Z
|
||||
<EFBFBD> CYR SMALL A
|
||||
<EFBFBD> CYR SMALL BE
|
||||
<EFBFBD> CYR SMALL VE
|
||||
<EFBFBD> CYR SMALL GE
|
||||
<EFBFBD> CYR SMALL DE
|
||||
<EFBFBD> CYR SMALL IE
|
||||
? CYR SMALL IO
|
||||
<EFBFBD> CYR SMALL ZHE
|
||||
<EFBFBD> CYR SMALL ZE
|
||||
<EFBFBD> CYR SMALL I
|
||||
<EFBFBD> CYR SMALL KA
|
||||
<EFBFBD> CYR SMALL EL
|
||||
<EFBFBD> CYR SMALL EM
|
||||
<EFBFBD> CYR SMALL EN
|
||||
<EFBFBD> CYR SMALL O
|
||||
<EFBFBD> CYR SMALL PE
|
||||
<EFBFBD> CYR SMALL ER
|
||||
<EFBFBD> CYR SMALL ES
|
||||
<EFBFBD> CYR SMALL TE
|
||||
<EFBFBD> CYR SMALL U
|
||||
<EFBFBD> CYR SMALL EF
|
||||
<EFBFBD> CYR SMALL HA
|
||||
<EFBFBD> CYR SMALL TSE
|
||||
<EFBFBD> CYR SMALL CHE
|
||||
<EFBFBD> CYR SMALL SHA
|
||||
<EFBFBD> CYR SMALL SCHA
|
||||
<EFBFBD> CYR SMALL HARD SIGN
|
||||
<EFBFBD> CYR SMALL YERU
|
||||
<EFBFBD> CYR SMALL SOFT SIGN
|
||||
<EFBFBD> CYR SMALL E
|
||||
<EFBFBD> CYR SMALL YU
|
||||
<EFBFBD> CYR SMALL YA
|
||||
<EFBFBD> CYR CAPIT A
|
||||
<EFBFBD> CYR CAPIT BE
|
||||
<EFBFBD> CYR CAPIT VE
|
||||
<EFBFBD> CYR CAPIT GE
|
||||
<EFBFBD> CYR CAPIT DE
|
||||
<EFBFBD> CYR CAPIT IE
|
||||
? CYR CAPIT IO
|
||||
<EFBFBD> CYR CAPIT ZHE
|
||||
<EFBFBD> CYR CAPIT ZE
|
||||
<EFBFBD> CYR CAPIT I
|
||||
<EFBFBD> CYR CAPIT KA
|
||||
<EFBFBD> CYR CAPIT EL
|
||||
<EFBFBD> CYR CAPIT EM
|
||||
<EFBFBD> CYR CAPIT EN
|
||||
<EFBFBD> CYR CAPIT O
|
||||
<EFBFBD> CYR CAPIT PE
|
||||
<EFBFBD> CYR CAPIT ER
|
||||
<EFBFBD> CYR CAPIT ES
|
||||
<EFBFBD> CYR CAPIT TE
|
||||
<EFBFBD> CYR CAPIT U
|
||||
<EFBFBD> CYR CAPIT EF
|
||||
<EFBFBD> CYR CAPIT HA
|
||||
<EFBFBD> CYR CAPIT TSE
|
||||
<EFBFBD> CYR CAPIT CHE
|
||||
<EFBFBD> CYR CAPIT SHA
|
||||
<EFBFBD> CYR CAPIT SCHA
|
||||
<EFBFBD> CYR CAPIT HARD SIGN
|
||||
<EFBFBD> CYR CAPIT YERU
|
||||
<EFBFBD> CYR CAPIT SOFT SIGN
|
||||
<EFBFBD> CYR CAPIT E
|
||||
<EFBFBD> CYR CAPIT YU
|
||||
<EFBFBD> CYR CAPIT YA
|
||||
explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 116
|
||||
Warnings:
|
||||
Note 1003 select high_priority convert(test.t1.koi8_ru_f,_latin1'utf8_general_ci',_latin1'cp1251_general_ci') AS `CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci')`,test.t1.comment AS `comment` from test.t1
|
||||
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
|
||||
UPDATE t1 SET bin_f=koi8_ru_f;
|
||||
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
|
||||
|
@ -22,7 +22,7 @@ Warning 1264 Data truncated for column 'c2' at row 1
|
||||
Warning 1264 Data truncated for column 'c3' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2 c3
|
||||
aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc
|
||||
aaaa aaaa aaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
|
||||
SHOW CREATE TABLE t1;
|
||||
|
@ -73,9 +73,97 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`date_format("2004-01-19 10:10:10", "%Y-%m-%d")` char(4) character set utf8 default NULL
|
||||
`date_format("2004-01-19 10:10:10", "%Y-%m-%d")` char(10) binary default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t1;
|
||||
date_format("2004-01-19 10:10:10", "%Y-%m-%d")
|
||||
2004-01-19
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1 (s1 char(1) character set utf8);
|
||||
insert into t1 values (_koi8r'<27><>');
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
|
||||
s1 hex(s1) char_length(s1) octet_length(s1)
|
||||
<EFBFBD> D0B0 1 2
|
||||
drop table t1;
|
||||
create table t1 (s1 tinytext character set utf8);
|
||||
insert into t1 select repeat('a',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('<27>',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('a<>',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('<27>a',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('<27><>',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
|
||||
D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
|
||||
61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F
|
||||
D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61
|
||||
D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
|
||||
select length(s1),char_length(s1) from t1;
|
||||
length(s1) char_length(s1)
|
||||
255 255
|
||||
254 127
|
||||
255 170
|
||||
255 170
|
||||
254 127
|
||||
drop table t1;
|
||||
create table t1 (s1 text character set utf8);
|
||||
insert into t1 select repeat('a',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('<27>',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('a<>',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('<27>a',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('<27><>',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select length(s1),char_length(s1) from t1;
|
||||
length(s1) char_length(s1)
|
||||
65535 65535
|
||||
65534 32767
|
||||
65535 43690
|
||||
65535 43690
|
||||
65534 32767
|
||||
drop table t1;
|
||||
create table t1 (s1 char(10) character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
41
|
||||
drop table t1;
|
||||
create table t1 (s1 varchar(10) character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
41
|
||||
drop table t1;
|
||||
create table t1 (s1 text character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
41
|
||||
drop table t1;
|
||||
|
@ -1,6 +1,4 @@
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
SHOW GLOBAL VARIABLES LIKE "%_format%";
|
||||
Variable_name Value
|
||||
date_format %d.%m.%Y
|
||||
|
@ -59,7 +59,7 @@ explain select * from t1 as x1, (select * from t1) as x2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY x1 ALL NULL NULL NULL NULL 4
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
|
||||
2 DERIVED x1 ALL NULL NULL NULL NULL 4
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 4
|
||||
drop table if exists t2,t3;
|
||||
select * from (select 1) as a;
|
||||
1
|
||||
@ -141,7 +141,7 @@ a t
|
||||
explain select count(*) from t1 as tt1, (select * from t1) as tt2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
2 DERIVED tt1 ALL NULL NULL NULL NULL 10000
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 10000
|
||||
drop table t1;
|
||||
SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
|
||||
(SELECT * FROM (SELECT 1 as a) as a )
|
||||
@ -189,13 +189,13 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
|
||||
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
|
||||
2 DERIVED m2 index NULL PRIMARY 3 NULL 9 Using index
|
||||
2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
|
||||
explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
|
||||
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
|
||||
2 DERIVED m2 index NULL PRIMARY 3 NULL 9 Using index
|
||||
2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
|
||||
drop table t1,t2;
|
||||
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
|
||||
x
|
||||
@ -229,7 +229,7 @@ explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DERIVED A ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
@ -252,9 +252,7 @@ drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`N` int(11) unsigned NOT NULL default '0',
|
||||
`M` tinyint(1) default '0',
|
||||
) TYPE=MyISAM DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||
select * from t1;
|
||||
@ -267,21 +265,23 @@ N M
|
||||
3 0
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
|
||||
ERROR HY000: The target table P2 of the UPDATE is not updatable.
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||
ERROR 42S22: Unknown column 'aaaa' in 'field list'
|
||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
select * from t1;
|
||||
N M
|
||||
3 0
|
||||
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
ERROR HY000: The target table P2 of the DELETE is not updatable.
|
||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
ERROR 42S22: Unknown column 'aaa' in 'field list'
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
OBJECTID int(11) NOT NULL default '0',
|
||||
SORTORDER int(11) NOT NULL auto_increment,
|
||||
KEY t1_SortIndex (SORTORDER),
|
||||
KEY t1_IdIndex (OBJECTID)
|
||||
) TYPE=MyISAM DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE t2 (
|
||||
ID int(11) default NULL,
|
||||
PARID int(11) default NULL,
|
||||
@ -298,3 +298,25 @@ INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00
|
||||
select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
|
||||
497 ID NULL
|
||||
drop table t1, t2, t3;
|
||||
CREATE TABLE t1 (name char(1) default NULL, val int(5) default NULL);
|
||||
INSERT INTO t1 VALUES ('a',1), ('a',2), ('a',2), ('a',2), ('a',3), ('a',6), ('a',7), ('a',11), ('a',11), ('a',12), ('a',13), ('a',13), ('a',20), ('b',2), ('b',3), ('b',4), ('b',5);
|
||||
SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
|
||||
name median
|
||||
a 7.0000
|
||||
b 3.5000
|
||||
explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
|
||||
2 DERIVED x ALL NULL NULL NULL NULL 17 Using temporary; Using filesort
|
||||
2 DERIVED y ALL NULL NULL NULL NULL 17 Using where
|
||||
drop table t1;
|
||||
create table t2 (a int, b int, primary key (a));
|
||||
insert into t2 values (1,7),(2,7);
|
||||
explain select a from t2 where a>1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
explain select a from (select a from t2 where a>1) tt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
drop table t2;
|
||||
|
@ -51,6 +51,20 @@ t1 CREATE TABLE `t1` (
|
||||
`version` char(40) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
|
||||
charset(charset(_utf8'a')) charset(collation(_utf8'a'))
|
||||
utf8 utf8
|
||||
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
|
||||
collation(charset(_utf8'a')) collation(collation(_utf8'a'))
|
||||
utf8_general_ci utf8_general_ci
|
||||
create table t1 select charset(_utf8'a'), collation(_utf8'a');
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`charset(_utf8'a')` char(64) character set utf8 NOT NULL default '',
|
||||
`collation(_utf8'a')` char(64) character set utf8 NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select TRUE,FALSE,NULL;
|
||||
TRUE FALSE NULL
|
||||
1 0 NULL
|
||||
|
@ -21,6 +21,11 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (a decimal(240, 20));
|
||||
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
||||
("0987654321098765432109876543210987654321");
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` decimal(240,20) default NULL
|
||||
@ -41,6 +46,11 @@ UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a double);
|
||||
INSERT INTO t1 VALUES (-9e999999);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` double default NULL
|
||||
@ -105,6 +115,11 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
|
||||
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` varchar(255) default NULL
|
||||
@ -123,3 +138,67 @@ UNLOCK TABLES;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int) ENGINE=MYISAM;
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (1),(2);
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (1),(2);
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
|
||||
DROP TABLE t1;
|
||||
create table ```a` (i int);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||
DROP TABLE IF EXISTS ```a`;
|
||||
CREATE TABLE ``a` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE ```a` DISABLE KEYS */;
|
||||
LOCK TABLES ```a` WRITE;
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE ```a` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
|
||||
drop table ```a`;
|
||||
|
@ -696,17 +696,22 @@ word
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile 'TEST_DIR/std_data/words.dat' into table t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
70
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
select * from t1 into outfile "query_caceh.out.file";
|
||||
select * from t1 into outfile "query_cache.out.file";
|
||||
select * from t1 into outfile "query_cache.out.file";
|
||||
ERROR HY000: File 'query_cache.out.file' already exists
|
||||
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
|
@ -31,7 +31,7 @@ n
|
||||
4
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-bin.000001 244 No #
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244 # Master master-bin.000001 244 No #
|
||||
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
|
||||
select * from t1;
|
||||
n
|
||||
|
@ -265,3 +265,51 @@ c decimal(4,3) YES NULL
|
||||
d double(4,3) YES NULL
|
||||
f float(4,3) YES NULL
|
||||
drop table t1;
|
||||
SET sql_mode='';
|
||||
SET sql_quote_show_create=OFF;
|
||||
CREATE TABLE ```ab``cd``` (i INT);
|
||||
SHOW CREATE TABLE ```ab``cd```;
|
||||
Table Create Table
|
||||
`ab`cd` CREATE TABLE ```ab``cd``` (
|
||||
i int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE ```ab``cd```;
|
||||
CREATE TABLE ```ab````cd``` (i INT);
|
||||
SHOW CREATE TABLE ```ab````cd```;
|
||||
Table Create Table
|
||||
`ab``cd` CREATE TABLE ```ab````cd``` (
|
||||
i int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE ```ab````cd```;
|
||||
CREATE TABLE ```a` (i INT);
|
||||
SHOW CREATE TABLE ```a`;
|
||||
Table Create Table
|
||||
`a CREATE TABLE ```a` (
|
||||
i int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE ```a`;
|
||||
SET sql_mode='ANSI_QUOTES';
|
||||
CREATE TABLE """a" (i INT);
|
||||
SHOW CREATE TABLE """a";
|
||||
Table Create Table
|
||||
"a CREATE TABLE """a" (
|
||||
i int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE """a";
|
||||
SET sql_mode='';
|
||||
SET sql_quote_show_create=OFF;
|
||||
CREATE TABLE t1 (i INT);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE t1 (
|
||||
i int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `table` (i INT);
|
||||
SHOW CREATE TABLE `table`;
|
||||
Table Create Table
|
||||
table CREATE TABLE `table` (
|
||||
i int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE `table`;
|
||||
SET sql_quote_show_create=ON;
|
||||
|
@ -70,7 +70,7 @@ t1 CREATE TABLE `t1` (
|
||||
`email` varchar(60) NOT NULL default '',
|
||||
PRIMARY KEY (`a`),
|
||||
UNIQUE KEY `email` (`email`)
|
||||
) ENGINE=HEAP ROW_FORMAT=DYNAMIC
|
||||
) TYPE=HEAP ROW_FORMAT=DYNAMIC
|
||||
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
|
@ -1340,8 +1340,8 @@ a
|
||||
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using index
|
||||
2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1000 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a)) limit 1))
|
||||
insert into t1 values (3,31);
|
||||
@ -1578,52 +1578,30 @@ select * from t1;
|
||||
a b
|
||||
1 0.123
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
ts timestamp NOT NULL,
|
||||
id_cns tinyint(3) unsigned NOT NULL default '0',
|
||||
id_desc_nota int(11) NOT NULL default '1',
|
||||
id_publ_uff int(11) NOT NULL default '0',
|
||||
tipo enum('','UNO','DUE') NOT NULL default '',
|
||||
f_aggiunte set('TRE','TRETRE','QUATTRO','CINQUE','SEI','SETTE') NOT NULL
|
||||
default '',
|
||||
anno_dep smallint(4) unsigned zerofill NOT NULL default '0000',
|
||||
data_dep smallint(4) unsigned zerofill NOT NULL default '0000',
|
||||
particolare mediumint(8) unsigned NOT NULL default '0',
|
||||
generale mediumint(8) unsigned NOT NULL default '0',
|
||||
bis tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY(id),
|
||||
UNIQUE KEY idx_cns_gen_anno (anno_dep,id_cns,generale,particolare),
|
||||
UNIQUE KEY idx_cns_par_anno (id_cns,anno_dep,tipo,particolare,bis)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;
|
||||
INSERT INTO t1 (id, ts, id_cns, id_desc_nota, id_publ_uff, tipo, f_aggiunte,
|
||||
anno_dep, data_dep, particolare, generale, bis) VALUES
|
||||
(NULL, NULL, 16, 29, 622, 'UNO', '', 1987, 1218, 2048, 9681, 0),
|
||||
(NULL, NULL, 50, 23, 1717, 'UNO', '', 1987, 1126, 1536, 13987, 0),
|
||||
(NULL, NULL, 16, 123, 123, 'UNO', '', 1987, 1221, 2432, 14594, 0),
|
||||
(NULL, NULL, 16, 124, 124, 'UNO', '', 1987, 1201, 1792, 13422, 0),
|
||||
(NULL, NULL, 16, 125, 125, 'UNO', '', 1987, 0723, 1025, 10240, 0),
|
||||
(NULL, NULL, 16, 126, 126, 'UNO', '', 1987, 1204, 1026, 7089, 0);
|
||||
CREATE TABLE t2 (
|
||||
id tinyint(3) unsigned NOT NULL auto_increment,
|
||||
descr varchar(40) NOT NULL default '',
|
||||
f_servizi set('UNO','DUE') NOT NULL default '',
|
||||
data_uno_min int(8) unsigned NOT NULL default '0',
|
||||
data_due_min int(8) unsigned NOT NULL default '0',
|
||||
max_anno_dep smallint(6) unsigned NOT NULL default '0',
|
||||
data_agg int(8) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (id)
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`id_cns` tinyint(3) unsigned NOT NULL default '0',
|
||||
`tipo` enum('','UNO','DUE') NOT NULL default '',
|
||||
`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
|
||||
`particolare` mediumint(8) unsigned NOT NULL default '0',
|
||||
`generale` mediumint(8) unsigned NOT NULL default '0',
|
||||
`bis` tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
|
||||
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
|
||||
);
|
||||
INSERT INTO t2 (id, descr, f_servizi, data_uno_min, data_due_min,
|
||||
max_anno_dep, data_agg) VALUES
|
||||
(16, 'C_UNO', 'UNO,DUE', 19000000, 30000000, 1987, 0),
|
||||
(50, 'C_TRE', 'UNO', 19000000, 30000000, 1990, 0);
|
||||
SELECT cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE
|
||||
s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM
|
||||
t2 AS cns;
|
||||
PIPPO
|
||||
1
|
||||
NULL
|
||||
INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
|
||||
CREATE TABLE `t2` (
|
||||
`id` tinyint(3) unsigned NOT NULL auto_increment,
|
||||
`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
|
||||
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
|
||||
id max_anno_dep PIPPO
|
||||
16 1987 1
|
||||
50 1990 0
|
||||
51 1990 NULL
|
||||
DROP TABLE t1, t2;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1), (2), (3);
|
||||
|
@ -446,39 +446,6 @@ CREATE TABLE t1 (a_dec DECIMAL(-1,1));
|
||||
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1
|
||||
create table t1(a decimal(7,3));
|
||||
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
|
||||
Warnings:
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 27
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 30
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 31
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 32
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 33
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 34
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 35
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 36
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 37
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 38
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 39
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 40
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 41
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 42
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 43
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 44
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 45
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 46
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 47
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 48
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 49
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 50
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 51
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 52
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 53
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 54
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 55
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 56
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 57
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 58
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 59
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 60
|
||||
select * from t1;
|
||||
a
|
||||
1.000
|
||||
@ -544,51 +511,6 @@ a
|
||||
drop table t1;
|
||||
create table t1(a decimal(7,3) unsigned);
|
||||
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
|
||||
Warnings:
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 3
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 6
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 9
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 12
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 15
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 18
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 21
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 24
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 25
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 26
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 27
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 28
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 29
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 30
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 31
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 32
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 33
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 34
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 35
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 36
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 37
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 38
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 39
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 40
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 41
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 42
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 43
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 44
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 45
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 46
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 47
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 48
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 49
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 50
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 51
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 52
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 53
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 54
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 55
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 56
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 57
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 58
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 59
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 60
|
||||
select * from t1;
|
||||
a
|
||||
1.000
|
||||
@ -654,51 +576,6 @@ a
|
||||
drop table t1;
|
||||
create table t1(a decimal(7,3) zerofill);
|
||||
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
|
||||
Warnings:
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 3
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 6
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 9
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 12
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 15
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 18
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 21
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 24
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 25
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 26
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 27
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 28
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 29
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 30
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 31
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 32
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 33
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 34
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 35
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 36
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 37
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 38
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 39
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 40
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 41
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 42
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 43
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 44
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 45
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 46
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 47
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 48
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 49
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 50
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 51
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 52
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 53
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 54
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 55
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 56
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 57
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 58
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 59
|
||||
Warning 1263 Data truncated, out of range for column 'a' at row 60
|
||||
select * from t1;
|
||||
a
|
||||
0001.000
|
||||
|
@ -1,7 +1,4 @@
|
||||
drop table if exists t1, t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
Note 1051 Unknown table 't2'
|
||||
SET SQL_WARNINGS=1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
|
@ -10,10 +10,17 @@ select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
|
||||
select ~5, cast(~5 as signed);
|
||||
explain extended select ~5, cast(~5 as signed);
|
||||
select cast(5 as unsigned) -6.0;
|
||||
select cast(NULL as signed), cast(1/0 as signed);
|
||||
select cast(NULL as unsigned), cast(1/0 as unsigned);
|
||||
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
|
||||
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
|
||||
select cast("1:2:3" as TIME);
|
||||
select CONVERT("2004-01-22 21:45:33",DATE);
|
||||
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
|
||||
select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
|
||||
|
||||
#
|
||||
# Character set convertion
|
||||
|
@ -147,11 +147,6 @@ UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
|
||||
SET CHARACTER SET koi8r;
|
||||
SELECT * FROM t1;
|
||||
|
||||
#
|
||||
# codecovarage for Item_func_conv_charset3
|
||||
#
|
||||
select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||
explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||
|
||||
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
|
||||
UPDATE t1 SET bin_f=koi8_ru_f;
|
||||
|
@ -53,3 +53,48 @@ show create table t1;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #2366 Wrong utf8 behaviour when data is trancated
|
||||
#
|
||||
set names koi8r;
|
||||
create table t1 (s1 char(1) character set utf8);
|
||||
insert into t1 values (_koi8r'<27><>');
|
||||
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 tinytext character set utf8);
|
||||
insert into t1 select repeat('a',300);
|
||||
insert into t1 select repeat('<27>',300);
|
||||
insert into t1 select repeat('a<>',300);
|
||||
insert into t1 select repeat('<27>a',300);
|
||||
insert into t1 select repeat('<27><>',300);
|
||||
select hex(s1) from t1;
|
||||
select length(s1),char_length(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 text character set utf8);
|
||||
insert into t1 select repeat('a',66000);
|
||||
insert into t1 select repeat('<27>',66000);
|
||||
insert into t1 select repeat('a<>',66000);
|
||||
insert into t1 select repeat('<27>a',66000);
|
||||
insert into t1 select repeat('<27><>',66000);
|
||||
select length(s1),char_length(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #2368 Multibyte charsets do not check that incoming data is well-formed
|
||||
#
|
||||
create table t1 (s1 char(10) character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
select hex(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 varchar(10) character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
select hex(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 text character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
select hex(s1) from t1;
|
||||
drop table t1;
|
||||
|
@ -2,9 +2,9 @@
|
||||
# Test of date format functions
|
||||
#
|
||||
|
||||
--disable-warnings
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable-warnings
|
||||
--enable_warnings
|
||||
|
||||
SHOW GLOBAL VARIABLES LIKE "%_format%";
|
||||
SHOW SESSION VARIABLES LIKE "%_format%";
|
||||
|
@ -147,16 +147,20 @@ drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`N` int(11) unsigned NOT NULL default '0',
|
||||
`M` tinyint(1) default '0',
|
||||
) TYPE=MyISAM DEFAULT CHARSET=latin1;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||
select * from t1;
|
||||
-- error 1287
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
|
||||
-- error 1054
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
select * from t1;
|
||||
-- error 1287
|
||||
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
-- error 1054
|
||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
@ -167,7 +171,7 @@ CREATE TABLE t1 (
|
||||
SORTORDER int(11) NOT NULL auto_increment,
|
||||
KEY t1_SortIndex (SORTORDER),
|
||||
KEY t1_IdIndex (OBJECTID)
|
||||
) TYPE=MyISAM DEFAULT CHARSET=latin1;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE t2 (
|
||||
ID int(11) default NULL,
|
||||
PARID int(11) default NULL,
|
||||
@ -183,3 +187,22 @@ CREATE TABLE t3 (
|
||||
INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
|
||||
select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
|
||||
#
|
||||
# explain derived
|
||||
#
|
||||
CREATE TABLE t1 (name char(1) default NULL, val int(5) default NULL);
|
||||
INSERT INTO t1 VALUES ('a',1), ('a',2), ('a',2), ('a',2), ('a',3), ('a',6), ('a',7), ('a',11), ('a',11), ('a',12), ('a',13), ('a',13), ('a',20), ('b',2), ('b',3), ('b',4), ('b',5);
|
||||
SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
|
||||
explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# "Using index" in explain
|
||||
#
|
||||
create table t2 (a int, b int, primary key (a));
|
||||
insert into t2 values (1,7),(2,7);
|
||||
explain select a from t2 where a>1;
|
||||
explain select a from (select a from t2 where a>1) tt;
|
||||
drop table t2;
|
||||
|
@ -23,4 +23,10 @@ create table t1 (version char(40)) select database(), user(), version() as 'vers
|
||||
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;
|
||||
|
@ -53,3 +53,21 @@ CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
|
||||
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #2634
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int) ENGINE=MYISAM;
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
--exec $MYSQL_DUMP --skip-comments --compatible=mysql40 test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #2592 'mysqldum doesn't quote "tricky" names correctly'
|
||||
#
|
||||
|
||||
create table ```a` (i int);
|
||||
--exec $MYSQL_DUMP --skip-comments test
|
||||
drop table ```a`;
|
||||
|
@ -466,8 +466,10 @@ select * from t1 where id=2;
|
||||
create table t1 (word char(20) not null);
|
||||
select * from t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
--replace_result $MYSQL_TEST_DIR TEST_DIR
|
||||
eval load data infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
select count(*) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
@ -476,7 +478,9 @@ drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
show status like "Qcache_queries_in_cache";
|
||||
select * from t1 into outfile "query_caceh.out.file";
|
||||
select * from t1 into outfile "query_cache.out.file";
|
||||
--error 1086
|
||||
select * from t1 into outfile "query_cache.out.file";
|
||||
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
|
||||
show status like "Qcache_queries_in_cache";
|
||||
drop table t1;
|
||||
|
@ -29,7 +29,7 @@ sleep 2;
|
||||
# here table should be still not deleted
|
||||
select * from t1;
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
--replace_column 1 # 33 #
|
||||
--replace_column 1 # 9 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
# this should fail right after start
|
||||
@ -59,9 +59,10 @@ stop slave;
|
||||
|
||||
# this should stop immideately
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=561;
|
||||
sleep 2;
|
||||
# 2 is not enough when running with valgrind
|
||||
real_sleep 4
|
||||
# here the sql slave thread should be stopped
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
|
||||
--replace_column 1 # 9 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
|
@ -142,3 +142,43 @@ drop table t1;
|
||||
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
|
||||
show columns from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes"
|
||||
#
|
||||
|
||||
SET sql_mode='';
|
||||
SET sql_quote_show_create=OFF;
|
||||
|
||||
CREATE TABLE ```ab``cd``` (i INT);
|
||||
SHOW CREATE TABLE ```ab``cd```;
|
||||
DROP TABLE ```ab``cd```;
|
||||
|
||||
CREATE TABLE ```ab````cd``` (i INT);
|
||||
SHOW CREATE TABLE ```ab````cd```;
|
||||
DROP TABLE ```ab````cd```;
|
||||
|
||||
CREATE TABLE ```a` (i INT);
|
||||
SHOW CREATE TABLE ```a`;
|
||||
DROP TABLE ```a`;
|
||||
|
||||
SET sql_mode='ANSI_QUOTES';
|
||||
|
||||
CREATE TABLE """a" (i INT);
|
||||
SHOW CREATE TABLE """a";
|
||||
DROP TABLE """a";
|
||||
|
||||
# to test quotes around keywords.. :
|
||||
|
||||
SET sql_mode='';
|
||||
SET sql_quote_show_create=OFF;
|
||||
|
||||
CREATE TABLE t1 (i INT);
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE `table` (i INT);
|
||||
SHOW CREATE TABLE `table`;
|
||||
DROP TABLE `table`;
|
||||
|
||||
SET sql_quote_show_create=ON;
|
||||
|
@ -1026,53 +1026,27 @@ drop table t1;
|
||||
# Bug 2479
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
ts timestamp NOT NULL,
|
||||
id_cns tinyint(3) unsigned NOT NULL default '0',
|
||||
id_desc_nota int(11) NOT NULL default '1',
|
||||
id_publ_uff int(11) NOT NULL default '0',
|
||||
tipo enum('','UNO','DUE') NOT NULL default '',
|
||||
f_aggiunte set('TRE','TRETRE','QUATTRO','CINQUE','SEI','SETTE') NOT NULL
|
||||
default '',
|
||||
anno_dep smallint(4) unsigned zerofill NOT NULL default '0000',
|
||||
data_dep smallint(4) unsigned zerofill NOT NULL default '0000',
|
||||
particolare mediumint(8) unsigned NOT NULL default '0',
|
||||
generale mediumint(8) unsigned NOT NULL default '0',
|
||||
bis tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY(id),
|
||||
UNIQUE KEY idx_cns_gen_anno (anno_dep,id_cns,generale,particolare),
|
||||
UNIQUE KEY idx_cns_par_anno (id_cns,anno_dep,tipo,particolare,bis)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;
|
||||
|
||||
INSERT INTO t1 (id, ts, id_cns, id_desc_nota, id_publ_uff, tipo, f_aggiunte,
|
||||
anno_dep, data_dep, particolare, generale, bis) VALUES
|
||||
(NULL, NULL, 16, 29, 622, 'UNO', '', 1987, 1218, 2048, 9681, 0),
|
||||
(NULL, NULL, 50, 23, 1717, 'UNO', '', 1987, 1126, 1536, 13987, 0),
|
||||
(NULL, NULL, 16, 123, 123, 'UNO', '', 1987, 1221, 2432, 14594, 0),
|
||||
(NULL, NULL, 16, 124, 124, 'UNO', '', 1987, 1201, 1792, 13422, 0),
|
||||
(NULL, NULL, 16, 125, 125, 'UNO', '', 1987, 0723, 1025, 10240, 0),
|
||||
(NULL, NULL, 16, 126, 126, 'UNO', '', 1987, 1204, 1026, 7089, 0);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
id tinyint(3) unsigned NOT NULL auto_increment,
|
||||
descr varchar(40) NOT NULL default '',
|
||||
f_servizi set('UNO','DUE') NOT NULL default '',
|
||||
data_uno_min int(8) unsigned NOT NULL default '0',
|
||||
data_due_min int(8) unsigned NOT NULL default '0',
|
||||
max_anno_dep smallint(6) unsigned NOT NULL default '0',
|
||||
data_agg int(8) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (id)
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`id_cns` tinyint(3) unsigned NOT NULL default '0',
|
||||
`tipo` enum('','UNO','DUE') NOT NULL default '',
|
||||
`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
|
||||
`particolare` mediumint(8) unsigned NOT NULL default '0',
|
||||
`generale` mediumint(8) unsigned NOT NULL default '0',
|
||||
`bis` tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
|
||||
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
|
||||
);
|
||||
INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
|
||||
CREATE TABLE `t2` (
|
||||
`id` tinyint(3) unsigned NOT NULL auto_increment,
|
||||
`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
|
||||
|
||||
INSERT INTO t2 (id, descr, f_servizi, data_uno_min, data_due_min,
|
||||
max_anno_dep, data_agg) VALUES
|
||||
(16, 'C_UNO', 'UNO,DUE', 19000000, 30000000, 1987, 0),
|
||||
(50, 'C_TRE', 'UNO', 19000000, 30000000, 1990, 0);
|
||||
|
||||
SELECT cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE
|
||||
s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM
|
||||
t2 AS cns;
|
||||
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
@ -248,7 +248,7 @@ CREATE TABLE t1 (a_dec DECIMAL(-1,1));
|
||||
#
|
||||
# Zero prepend overflow bug
|
||||
#
|
||||
--disable-warnings
|
||||
--disable_warnings
|
||||
create table t1(a decimal(7,3));
|
||||
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
|
||||
select * from t1;
|
||||
@ -259,6 +259,6 @@ select * from t1;
|
||||
drop table t1;
|
||||
create table t1(a decimal(7,3) zerofill);
|
||||
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
|
||||
--enable-warnings
|
||||
--enable_warnings
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -1,9 +1,9 @@
|
||||
#
|
||||
# Test some warnings
|
||||
#
|
||||
--disable-warnings
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable-warnings
|
||||
--enable_warnings
|
||||
SET SQL_WARNINGS=1;
|
||||
|
||||
create table t1 (a int);
|
||||
|
Reference in New Issue
Block a user