summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-10-16 12:34:17 +0200
committerSergei Golubchik <serg@mariadb.org>2017-10-17 07:37:39 +0200
commitb036b6b59464524d7dd54a4c9a75b5ee8a14dbe0 (patch)
tree20b6bfb5878bdb3a76a85caa8c9d0140891a2531
parent19a702a85c69d241e360d1d5a040378928a3fdca (diff)
downloadmariadb-git-b036b6b59464524d7dd54a4c9a75b5ee8a14dbe0.tar.gz
MDEV-13937 Aria engine: Internal Error 160 after partition handling
Partition wasn't setting HA_OPTION_PACK_RECORD on ALTER TABLE if the row format was PAGE. (so one bit in the null bitmap was reserved for a deleted bit - see make_empty_rec - and all actual null bits were one off)
-rw-r--r--mysql-test/suite/parts/r/partition_alter_maria.result18
-rw-r--r--mysql-test/suite/parts/t/partition_alter_maria.test18
-rw-r--r--sql/sql_partition.cc3
3 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/suite/parts/r/partition_alter_maria.result b/mysql-test/suite/parts/r/partition_alter_maria.result
new file mode 100644
index 00000000000..6343566e408
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_alter_maria.result
@@ -0,0 +1,18 @@
+create table t1 (
+pk bigint not null auto_increment,
+dt datetime default null,
+unique (pk, dt)
+) engine=aria row_format=dynamic
+partition by range columns(dt) (
+partition `p20171231` values less than ('2017-12-31'),
+partition `p20181231` values less than ('2018-12-31')
+);
+insert into t1 values (1,'2017-09-28 15:12:00');
+select * from t1;
+pk dt
+1 2017-09-28 15:12:00
+alter table t1 drop partition p20181231;
+select * from t1;
+pk dt
+1 2017-09-28 15:12:00
+drop table t1;
diff --git a/mysql-test/suite/parts/t/partition_alter_maria.test b/mysql-test/suite/parts/t/partition_alter_maria.test
new file mode 100644
index 00000000000..db249591158
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_alter_maria.test
@@ -0,0 +1,18 @@
+#
+# MDEV-13937 Aria engine: Internal Error 160 after partition handling
+#
+source include/have_partition.inc;
+create table t1 (
+ pk bigint not null auto_increment,
+ dt datetime default null,
+ unique (pk, dt)
+) engine=aria row_format=dynamic
+ partition by range columns(dt) (
+ partition `p20171231` values less than ('2017-12-31'),
+ partition `p20181231` values less than ('2018-12-31')
+);
+insert into t1 values (1,'2017-09-28 15:12:00');
+select * from t1;
+alter table t1 drop partition p20181231;
+select * from t1;
+drop table t1;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index bf34d328dc5..cb01f8e339f 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -6672,7 +6672,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
lpt->alter_info= alter_info;
lpt->create_info= create_info;
lpt->db_options= create_info->table_options;
- if (create_info->row_type == ROW_TYPE_DYNAMIC)
+ if (create_info->row_type != ROW_TYPE_FIXED &&
+ create_info->row_type != ROW_TYPE_DEFAULT)
lpt->db_options|= HA_OPTION_PACK_RECORD;
lpt->table= fast_alter_table;
lpt->old_table= table;