mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#38005 Partitions: error with insert select.
MyISAM blocks index usage for bulk insert into zero-records tables. See ha_myisam::start_bulk_insert() lines from ... if (file->state->records == 0 ... ... That causes problems for partition engine when some partitions have records some not as the engine uses same access method for all partitions. Now partition engine doesn't call index_first/index_last for empty tables. per-file comments: mysql-test/r/partition.result Bug#38005 Partitions: error with insert select. test result mysql-test/t/partition.test Bug#38005 Partitions: error with insert select. test case sql/ha_partition.cc Bug#38005 Partitions: error with insert select. ha_engine::index_first and ha_engine::index_last not called for empty tables.
This commit is contained in:
@ -1637,4 +1637,74 @@ select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
|
||||
count(*)
|
||||
1
|
||||
drop table t1, t2;
|
||||
create table t1 (s1 int) partition by hash(s1) partitions 2;
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (1);
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1 order by s1 desc;
|
||||
select * from t1;
|
||||
s1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (s1 int) partition by range(s1)
|
||||
(partition pa1 values less than (10),
|
||||
partition pa2 values less than MAXVALUE);
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (1);
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1 order by s1 desc;
|
||||
select * from t1;
|
||||
s1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (s1 int) partition by range(s1)
|
||||
(partition pa1 values less than (10),
|
||||
partition pa2 values less than MAXVALUE);
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (20);
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1 order by s1 desc;
|
||||
select * from t1;
|
||||
s1
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
drop table t1;
|
||||
create table t1 (s1 int) partition by range(s1)
|
||||
(partition pa1 values less than (10),
|
||||
partition pa2 values less than MAXVALUE);
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8);
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1 order by s1 desc;
|
||||
insert into t1 select s1 from t1 where s1=3;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
288
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user