mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge with 4.1
This commit is contained in:
@ -513,9 +513,9 @@ drop database mysqltest;
|
||||
select database();
|
||||
database()
|
||||
NULL
|
||||
select database();
|
||||
database()
|
||||
NULL
|
||||
select database(), user();
|
||||
database() user()
|
||||
NULL mysqltest_1@localhost
|
||||
use test;
|
||||
create table t1 (a int, index `primary` (a));
|
||||
ERROR 42000: Incorrect index name 'primary'
|
||||
@ -579,7 +579,6 @@ select * from t2;
|
||||
b
|
||||
1
|
||||
drop table t1,t2;
|
||||
use test;
|
||||
create table t1 (a int);
|
||||
create table t1 select * from t1;
|
||||
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
||||
|
@ -7,3 +7,15 @@ SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
|
||||
a length(a) a='' a=' ' a=' '
|
||||
0 1 1 1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
popisek varchar(30) collate cp1250_general_ci NOT NULL default '',
|
||||
PRIMARY KEY (`popisek`)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('2005-01-1');
|
||||
SELECT * FROM t1 WHERE popisek = '2005-01-1';
|
||||
popisek
|
||||
2005-01-1
|
||||
SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
|
||||
popisek
|
||||
2005-01-1
|
||||
drop table t1;
|
||||
|
@ -343,18 +343,6 @@ GROUP_CONCAT(b ORDER BY b)
|
||||
First Row
|
||||
Second Row
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
||||
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
||||
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
||||
a_id b_list
|
||||
1 1,2,3
|
||||
2 4,5
|
||||
3 NULL
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
|
||||
INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
|
||||
CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
|
||||
@ -462,6 +450,49 @@ SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
||||
gc
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
create table t2 (a int, b int);
|
||||
insert into t2 values (1,1), (2,2);
|
||||
select b x, (select group_concat(x) from t2) from t2;
|
||||
x (select group_concat(x) from t2)
|
||||
1 1,1
|
||||
2 2,2
|
||||
drop table t2;
|
||||
create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int);
|
||||
insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3);
|
||||
select d,a,b from t1 order by a;
|
||||
d a b
|
||||
1 1 3
|
||||
2 1 4
|
||||
3 1 2
|
||||
5 1 1
|
||||
6 1 2
|
||||
4 2 7
|
||||
7 2 3
|
||||
8 2 3
|
||||
explain select a, group_concat(b) from t1 group by a with rollup;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
|
||||
select a, group_concat(b) from t1 group by a with rollup;
|
||||
a group_concat(b)
|
||||
1 3,4,2,1,2
|
||||
2 7,3,3
|
||||
NULL 3,4,2,1,2,7,3,3
|
||||
select a, group_concat(distinct b) from t1 group by a with rollup;
|
||||
a group_concat(distinct b)
|
||||
1 3,4,2,1
|
||||
2 7,3
|
||||
NULL 3,4,2,1,7
|
||||
select a, group_concat(b order by b) from t1 group by a with rollup;
|
||||
a group_concat(b order by b)
|
||||
1 1,2,2,3,4
|
||||
2 3,3,7
|
||||
NULL 1,2,2,3,3,3,4,7
|
||||
select a, group_concat(distinct b order by b) from t1 group by a with rollup;
|
||||
a group_concat(distinct b order by b)
|
||||
1 1,2,3,4
|
||||
2 3,7
|
||||
NULL 1,2,3,4,7
|
||||
drop table t1;
|
||||
create table t1 (a char(3), b char(20), primary key (a, b));
|
||||
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
|
||||
select group_concat(a) from t1 group by b;
|
||||
@ -469,10 +500,3 @@ group_concat(a)
|
||||
ABW
|
||||
ABW
|
||||
drop table t1;
|
||||
create table r2 (a int, b int);
|
||||
insert into r2 values (1,1), (2,2);
|
||||
select b x, (select group_concat(x) from r2) from r2;
|
||||
x (select group_concat(x) from r2)
|
||||
1 1,1
|
||||
2 2,2
|
||||
drop table r2;
|
||||
|
@ -931,7 +931,6 @@ a
|
||||
1
|
||||
2
|
||||
truncate table t1;
|
||||
truncate table t1;
|
||||
insert into t1 values(1),(2);
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
@ -1654,6 +1653,46 @@ show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
drop table t1;
|
||||
create table t1 (c char(10), index (c,c)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
|
||||
alter table t1 add key (c1,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c2,c1,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c2,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c1,c2);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
drop table t1;
|
||||
create table t1(a int(1) , b int(1)) engine=innodb;
|
||||
insert into t1 values ('1111', '3333');
|
||||
select distinct concat(a, b) from t1;
|
||||
concat(a, b)
|
||||
11113333
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||
ERROR HY000: The used table type doesn't support FULLTEXT indexes
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
||||
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
||||
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
||||
a_id b_list
|
||||
1 1,2,3
|
||||
2 4,5
|
||||
3 NULL
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
||||
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
||||
select * from t1;
|
||||
@ -1688,24 +1727,6 @@ select count(*) from t1 where x = 18446744073709551601;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (c char(10), index (c,c)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
|
||||
alter table t1 add key (c1,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c2,c1,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c2,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c1,c2);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
drop table t1;
|
||||
show status like "Innodb_buffer_pool_pages_total";
|
||||
Variable_name Value
|
||||
Innodb_buffer_pool_pages_total 512
|
||||
@ -2391,16 +2412,6 @@ drop table t1;
|
||||
set storage_engine=MyISAM;
|
||||
create table t1 (v varchar(16384)) engine=innodb;
|
||||
drop table t1;
|
||||
create table t1(a int(1) , b int(1)) engine=innodb;
|
||||
insert into t1 values ('1111', '3333');
|
||||
select distinct concat(a, b) from t1;
|
||||
concat(a, b)
|
||||
11113333
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||
ERROR HY000: The used table type doesn't support FULLTEXT indexes
|
||||
DROP TABLE t1;
|
||||
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
|
||||
insert into t1 values ('8', '6'), ('4', '7');
|
||||
select min(a) from t1;
|
||||
|
@ -88,7 +88,7 @@ TV NULL NULL 600
|
||||
NULL NULL NULL 7785
|
||||
explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`product` AS `product`,`test`.`t1`.`country_id` AS `country_id`,`test`.`t1`.`year` AS `year`,sum(`test`.`t1`.`profit`) AS `sum(profit)` from `test`.`t1` group by `test`.`t1`.`product`,`test`.`t1`.`country_id`,`test`.`t1`.`year` with rollup
|
||||
select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
|
||||
|
@ -181,3 +181,56 @@ drop table t1;
|
||||
set table_type=MYISAM;
|
||||
Warnings:
|
||||
Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
update t1 set a='abc';
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
Warning 1265 Data truncated for column 'a' at row 2
|
||||
Warning 1265 Data truncated for column 'a' at row 3
|
||||
Warning 1265 Data truncated for column 'a' at row 4
|
||||
Warning 1265 Data truncated for column 'a' at row 5
|
||||
Warning 1265 Data truncated for column 'a' at row 6
|
||||
Warning 1265 Data truncated for column 'a' at row 7
|
||||
Warning 1265 Data truncated for column 'a' at row 8
|
||||
Warning 1265 Data truncated for column 'a' at row 9
|
||||
Warning 1265 Data truncated for column 'a' at row 10
|
||||
show warnings limit 2, 1;
|
||||
Level Code Message
|
||||
Warning 1265 Data truncated for column 'a' at row 3
|
||||
show warnings limit 0, 10;
|
||||
Level Code Message
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
Warning 1265 Data truncated for column 'a' at row 2
|
||||
Warning 1265 Data truncated for column 'a' at row 3
|
||||
Warning 1265 Data truncated for column 'a' at row 4
|
||||
Warning 1265 Data truncated for column 'a' at row 5
|
||||
Warning 1265 Data truncated for column 'a' at row 6
|
||||
Warning 1265 Data truncated for column 'a' at row 7
|
||||
Warning 1265 Data truncated for column 'a' at row 8
|
||||
Warning 1265 Data truncated for column 'a' at row 9
|
||||
Warning 1265 Data truncated for column 'a' at row 10
|
||||
show warnings limit 9, 1;
|
||||
Level Code Message
|
||||
Warning 1265 Data truncated for column 'a' at row 10
|
||||
show warnings limit 10, 1;
|
||||
Level Code Message
|
||||
show warnings limit 9, 2;
|
||||
Level Code Message
|
||||
Warning 1265 Data truncated for column 'a' at row 10
|
||||
show warnings limit 0, 0;
|
||||
Level Code Message
|
||||
show warnings limit 1;
|
||||
Level Code Message
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
show warnings limit 0;
|
||||
Level Code Message
|
||||
show warnings limit 1, 0;
|
||||
Level Code Message
|
||||
select * from t1 limit 0;
|
||||
a
|
||||
select * from t1 limit 1, 0;
|
||||
a
|
||||
select * from t1 limit 0, 0;
|
||||
a
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user