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 ...@@ -426,5 +426,11 @@ create or replace table t1 (pk int auto_increment unique) with system versioning
insert into t1 values (1); insert into t1 values (1);
delete from t1; delete from t1;
alter table t1 engine=myisam; 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; drop database test;
create database test; create database test;
...@@ -344,7 +344,7 @@ create or replace table t (sys_trx_end int); ...@@ -344,7 +344,7 @@ create or replace table t (sys_trx_end int);
alter table t with system versioning; alter table t with system versioning;
ERROR 42S21: Duplicate column name 'sys_trx_end' ERROR 42S21: Duplicate column name 'sys_trx_end'
create or replace temporary table t (x28 int) with system versioning; 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 ( create or replace table t1 (
x29 int unsigned, x29 int unsigned,
Sys_start0 timestamp(6) as row start invisible, Sys_start0 timestamp(6) as row start invisible,
......
...@@ -362,5 +362,13 @@ insert into t1 values (1); ...@@ -362,5 +362,13 @@ insert into t1 values (1);
delete from t1; delete from t1;
alter table t1 engine=myisam; 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; drop database test;
create database test; create database test;
...@@ -313,7 +313,7 @@ create or replace table t (sys_trx_end int); ...@@ -313,7 +313,7 @@ create or replace table t (sys_trx_end int);
--error ER_DUP_FIELDNAME --error ER_DUP_FIELDNAME
alter table t with system versioning; 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; create or replace temporary table t (x28 int) with system versioning;
--error ER_VERS_DUPLICATE_ROW_START_END --error ER_VERS_DUPLICATE_ROW_START_END
......
...@@ -7188,9 +7188,14 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info, ...@@ -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); List_iterator_fast<Create_field> it(alter_info->create_list);
while (Create_field *f= it++) while (Create_field *f= it++)
{ {
if (f->change.length && if (f->change.length && f->flags & VERS_SYSTEM_FIELD)
f->flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG))
{ {
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( if (thd->mdl_context.upgrade_shared_lock(
table->mdl_ticket, MDL_EXCLUSIVE, table->mdl_ticket, MDL_EXCLUSIVE,
thd->variables.lock_wait_timeout)) thd->variables.lock_wait_timeout))
......
...@@ -7932,3 +7932,6 @@ WARN_VERS_TRT_EXPERIMENTAL ...@@ -7932,3 +7932,6 @@ WARN_VERS_TRT_EXPERIMENTAL
ER_VERS_TRUNCATE_VIEW ER_VERS_TRUNCATE_VIEW
eng "DELETE HISTORY from VIEW is prohibited" eng "DELETE HISTORY from VIEW is prohibited"
ER_VERS_TEMPORARY
eng "%s prohibited for TEMPORARY tables"
...@@ -6235,8 +6235,7 @@ versioning_option: ...@@ -6235,8 +6235,7 @@ versioning_option:
{ {
if (!thd->variables.vers_force) if (!thd->variables.vers_force)
{ {
my_error(ER_WRONG_USAGE, MYF(0), my_error(ER_VERS_TEMPORARY, MYF(0), "WITH SYSTEM VERSIONING");
"TEMPORARY", "WITH SYSTEM VERSIONING");
MYSQL_YYABORT; 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