Commit a04a2834 authored by Eugene Kosov's avatar Eugene Kosov Committed by GitHub

MDEV-14692 Server crash in MDL_ticket::has_stronger_or_equal_type

SQL: disable system-versioning stuff on TEMPORARY tables
parent acdfacee
......@@ -426,5 +426,11 @@ create or replace table t1 (pk int auto_increment unique) with system versioning
insert into t1 values (1);
delete from t1;
alter table t1 engine=myisam;
# MDEV-14692 crash in MDL_context::upgrade_shared_lock()
create or replace temporary table t (a int);
alter table t change column if exists b c bigint unsigned generated always as row start;
ERROR HY000: GENERATED AS ROW START prohibited for TEMPORARY tables
alter table t change column if exists b c bigint unsigned generated always as row end;
ERROR HY000: GENERATED AS ROW END prohibited for TEMPORARY tables
drop database test;
create database test;
......@@ -344,7 +344,7 @@ create or replace table t (sys_trx_end int);
alter table t with system versioning;
ERROR 42S21: Duplicate column name 'sys_trx_end'
create or replace temporary table t (x28 int) with system versioning;
ERROR HY000: Incorrect usage of TEMPORARY and WITH SYSTEM VERSIONING
ERROR HY000: WITH SYSTEM VERSIONING prohibited for TEMPORARY tables
create or replace table t1 (
x29 int unsigned,
Sys_start0 timestamp(6) as row start invisible,
......
......@@ -362,5 +362,13 @@ insert into t1 values (1);
delete from t1;
alter table t1 engine=myisam;
--echo # MDEV-14692 crash in MDL_context::upgrade_shared_lock()
create or replace temporary table t (a int);
--error ER_VERS_TEMPORARY
alter table t change column if exists b c bigint unsigned generated always as row start;
--error ER_VERS_TEMPORARY
alter table t change column if exists b c bigint unsigned generated always as row end;
drop database test;
create database test;
......@@ -313,7 +313,7 @@ create or replace table t (sys_trx_end int);
--error ER_DUP_FIELDNAME
alter table t with system versioning;
--error ER_WRONG_USAGE
--error ER_VERS_TEMPORARY
create or replace temporary table t (x28 int) with system versioning;
--error ER_VERS_DUPLICATE_ROW_START_END
......
......@@ -7188,9 +7188,14 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
List_iterator_fast<Create_field> it(alter_info->create_list);
while (Create_field *f= it++)
{
if (f->change.length &&
f->flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG))
if (f->change.length && f->flags & VERS_SYSTEM_FIELD)
{
if (share->table_category == TABLE_CATEGORY_TEMPORARY) {
my_error(ER_VERS_TEMPORARY, MYF(0),
f->flags & VERS_SYS_START_FLAG ? "GENERATED AS ROW START"
: "GENERATED AS ROW END");
return true;
}
if (thd->mdl_context.upgrade_shared_lock(
table->mdl_ticket, MDL_EXCLUSIVE,
thd->variables.lock_wait_timeout))
......
......@@ -7932,3 +7932,6 @@ WARN_VERS_TRT_EXPERIMENTAL
ER_VERS_TRUNCATE_VIEW
eng "DELETE HISTORY from VIEW is prohibited"
ER_VERS_TEMPORARY
eng "%s prohibited for TEMPORARY tables"
......@@ -6235,8 +6235,7 @@ versioning_option:
{
if (!thd->variables.vers_force)
{
my_error(ER_WRONG_USAGE, MYF(0),
"TEMPORARY", "WITH SYSTEM VERSIONING");
my_error(ER_VERS_TEMPORARY, MYF(0), "WITH SYSTEM VERSIONING");
MYSQL_YYABORT;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment