summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/versioning/r/partition.result9
-rw-r--r--mysql-test/suite/versioning/t/partition.test10
-rw-r--r--sql/sql_yacc.yy1
-rw-r--r--sql/sql_yacc_ora.yy1
4 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index 6472c0480c3..8344e91a34f 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -746,4 +746,13 @@ explain partitions select * from t1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pn # NULL NULL NULL NULL # #
drop table t1;
+#
+# MDEV-27244 Table corruption upon adding serial data type
+#
+create table t1 (f int, key(f)) with system versioning
+partition by system_time limit 10 (partition p0 history, partition pn current);
+alter table t1 add x serial;
+alter table t1 add partition (partition p1 history);
+alter table t1 add partition (partition p2 history);
+drop table t1;
# End of 10.3 tests
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index c5f6b242b53..6eeb305c218 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -727,6 +727,16 @@ explain partitions select * from t1 for system_time as of '2000-01-01 02:00:00';
explain partitions select * from t1;
drop table t1;
+--echo #
+--echo # MDEV-27244 Table corruption upon adding serial data type
+--echo #
+create table t1 (f int, key(f)) with system versioning
+partition by system_time limit 10 (partition p0 history, partition pn current);
+alter table t1 add x serial;
+alter table t1 add partition (partition p1 history);
+alter table t1 add partition (partition p2 history);
+drop table t1;
+
--echo # End of 10.3 tests
--source suite/versioning/common_finish.inc
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index b26ddcbb9e5..01e3922040b 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -6783,6 +6783,7 @@ field_type_or_serial:
Lex->last_field->set_handler(&type_handler_longlong);
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
+ Lex->alter_info.flags|= ALTER_ADD_INDEX;
}
opt_serial_attribute
;
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 93315add399..5e17e41a940 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -6625,6 +6625,7 @@ field_type_or_serial:
Lex->last_field->set_handler(&type_handler_longlong);
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
+ Lex->alter_info.flags|= ALTER_ADD_INDEX;
}
opt_serial_attribute
;