mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Move USE_PRAGMA_IMPLEMENTATION to proper place
Ensure that 'null_value' is not accessed before val() is called in FIELD() functions Fixed initialization of key maps. This fixes some problems with keys when you have more than 64 keys Fixed that ROLLUP don't always create a temporary table. This fix ensures that func_gconcat.test results are now predictable
This commit is contained in:
@ -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,15 +450,28 @@ SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
||||
gc
|
||||
NULL
|
||||
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)
|
||||
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 r2;
|
||||
create table t1 (d int, a int, b int, c int);
|
||||
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
|
||||
|
@ -1647,3 +1647,15 @@ 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;
|
||||
|
@ -83,7 +83,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;
|
||||
|
@ -213,21 +213,6 @@ INSERT INTO t1 VALUES (1,'First Row'), (2,'Second Row');
|
||||
SELECT GROUP_CONCAT(b ORDER BY b) FROM t1 GROUP BY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# check null values #1
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
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;
|
||||
--enable_warnings
|
||||
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;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# check null values #2
|
||||
#
|
||||
@ -288,17 +273,19 @@ DROP TABLE t1;
|
||||
#
|
||||
# Bug #8656: Crash with group_concat on alias in outer table
|
||||
#
|
||||
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;
|
||||
drop table r2;
|
||||
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;
|
||||
drop table t2;
|
||||
|
||||
#
|
||||
# Bug #7405: problems with rollup
|
||||
#
|
||||
|
||||
create table t1 (d int, a int, b int, c int);
|
||||
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;
|
||||
explain select a, group_concat(b) from t1 group by a with rollup;
|
||||
select a, group_concat(b) from t1 group by a with rollup;
|
||||
select a, group_concat(distinct b) from t1 group by a with rollup;
|
||||
select a, group_concat(b order by b) from t1 group by a with rollup;
|
||||
|
@ -1187,3 +1187,18 @@ CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||
--error 1214;
|
||||
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# check null values #1
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
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;
|
||||
--enable_warnings
|
||||
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;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user