diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-01-24 13:41:44 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-01-24 13:41:44 +0100 |
commit | e24398ee42c05f6e0589d2c27cb2ab4593b74ad4 (patch) | |
tree | 650a6f2ff8811bc275b9b6fd16c5305094a102ae | |
parent | 49b7a1f48d4e263e572df825ab89004893963f87 (diff) | |
download | mariadb-git-e24398ee42c05f6e0589d2c27cb2ab4593b74ad4.tar.gz |
Bug#59297: Can't find record in 'tablename' on update inner join
Regression introduced in bug#52455. Problem was that the
fixed function did not set the last used partition variable, resulting
in wrong partition used when storing the position of the newly
retrieved row.
Fixed by setting the last used partition in ha_partition::index_read_idx_map.
-rw-r--r-- | mysql-test/r/partition.result | 38 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 43 | ||||
-rw-r--r-- | sql/ha_partition.cc | 1 |
3 files changed, 82 insertions, 0 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 27ada9d1129..138264fd4e1 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,5 +1,43 @@ drop table if exists t1, t2; # +# Bug#59297: Can't find record in 'tablename' on update inner join +# +CREATE TABLE t1 ( +a char(2) NOT NULL, +b char(2) NOT NULL, +c int(10) unsigned NOT NULL, +d varchar(255) DEFAULT NULL, +e varchar(1000) DEFAULT NULL, +PRIMARY KEY (a, b, c), +KEY (a), +KEY (a, b) +) +/*!50100 PARTITION BY KEY (a) +PARTITIONS 20 */; +INSERT INTO t1 (a, b, c, d, e) VALUES +('07', '03', 343, '1', '07_03_343'), +('01', '04', 343, '2', '01_04_343'), +('01', '06', 343, '3', '01_06_343'), +('01', '07', 343, '4', '01_07_343'), +('01', '08', 343, '5', '01_08_343'), +('01', '09', 343, '6', '01_09_343'), +('03', '03', 343, '7', '03_03_343'), +('03', '06', 343, '8', '03_06_343'), +('03', '07', 343, '9', '03_07_343'), +('04', '03', 343, '10', '04_03_343'), +('04', '06', 343, '11', '04_06_343'), +('05', '03', 343, '12', '05_03_343'), +('11', '03', 343, '13', '11_03_343'), +('11', '04', 343, '14', '11_04_343') +; +UPDATE t1 AS A, +(SELECT '03' AS a, '06' AS b, 343 AS c, 'last' AS d) AS B +SET A.e = B.d +WHERE A.a = '03' +AND A.b = '06' +AND A.c = 343; +DROP TABLE t1; +# # Bug#57113: ha_partition::extra(ha_extra_function): # Assertion `m_extra_cache' failed CREATE TABLE t1 diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 0151820cef9..7a0a5558d32 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -15,6 +15,49 @@ drop table if exists t1, t2; --enable_warnings --echo # +--echo # Bug#59297: Can't find record in 'tablename' on update inner join +--echo # + +CREATE TABLE t1 ( +a char(2) NOT NULL, +b char(2) NOT NULL, +c int(10) unsigned NOT NULL, +d varchar(255) DEFAULT NULL, +e varchar(1000) DEFAULT NULL, +PRIMARY KEY (a, b, c), +KEY (a), +KEY (a, b) +) +/*!50100 PARTITION BY KEY (a) +PARTITIONS 20 */; + +INSERT INTO t1 (a, b, c, d, e) VALUES +('07', '03', 343, '1', '07_03_343'), +('01', '04', 343, '2', '01_04_343'), +('01', '06', 343, '3', '01_06_343'), +('01', '07', 343, '4', '01_07_343'), +('01', '08', 343, '5', '01_08_343'), +('01', '09', 343, '6', '01_09_343'), +('03', '03', 343, '7', '03_03_343'), +('03', '06', 343, '8', '03_06_343'), +('03', '07', 343, '9', '03_07_343'), +('04', '03', 343, '10', '04_03_343'), +('04', '06', 343, '11', '04_06_343'), +('05', '03', 343, '12', '05_03_343'), +('11', '03', 343, '13', '11_03_343'), +('11', '04', 343, '14', '11_04_343') +; + +UPDATE t1 AS A, +(SELECT '03' AS a, '06' AS b, 343 AS c, 'last' AS d) AS B +SET A.e = B.d +WHERE A.a = '03' +AND A.b = '06' +AND A.c = 343; + +DROP TABLE t1; + +--echo # --echo # Bug#57113: ha_partition::extra(ha_extra_function): --echo # Assertion `m_extra_cache' failed CREATE TABLE t1 diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 7bcbd241541..f55c48189fe 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4317,6 +4317,7 @@ int ha_partition::index_read_idx_map(uchar *buf, uint index, break; } } + m_last_part= part; } else { |