summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2017-12-29 16:28:13 +0300
committerAleksey Midenkov <midenok@gmail.com>2018-01-01 23:37:02 +0300
commit157150cfcf5b95b19d332cb1373aeb5eb22d4f70 (patch)
treea1fe42bd3882b48d47a3c52b71fa6f49bde010d0
parent7069071d7de774dcf28f73b6a968bcb730a12885 (diff)
downloadmariadb-git-157150cfcf5b95b19d332cb1373aeb5eb22d4f70.tar.gz
MDEV-14769 Temporary table can be altered into system versioning + system_versioning_alter_history has no effect
-rw-r--r--mysql-test/suite/versioning/r/alter.result6
-rw-r--r--mysql-test/suite/versioning/r/create.result2
-rw-r--r--mysql-test/suite/versioning/t/alter.test6
-rw-r--r--sql/handler.cc6
-rw-r--r--sql/share/errmsg-utf8.txt2
-rw-r--r--sql/sql_yacc.yy2
6 files changed, 17 insertions, 7 deletions
diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result
index 8643f7c9953..74bf3f5b854 100644
--- a/mysql-test/suite/versioning/r/alter.result
+++ b/mysql-test/suite/versioning/r/alter.result
@@ -429,9 +429,11 @@ 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: This is not yet supported for generated columns
+ERROR HY000: System versioning prohibited for TEMPORARY tables
alter table t change column if exists b c bigint unsigned generated always as row end;
-ERROR HY000: This is not yet supported for generated columns
+ERROR HY000: System versioning prohibited for TEMPORARY tables
+alter table t add system versioning;
+ERROR HY000: System versioning prohibited for TEMPORARY tables
drop table t;
# MDEV-14744 trx_id-based and transaction-based mixup in assertion
create or replace table t (c text) engine=innodb with system versioning;
diff --git a/mysql-test/suite/versioning/r/create.result b/mysql-test/suite/versioning/r/create.result
index fa2ccefced7..62401eaeef0 100644
--- a/mysql-test/suite/versioning/r/create.result
+++ b/mysql-test/suite/versioning/r/create.result
@@ -348,7 +348,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: WITH SYSTEM VERSIONING prohibited for TEMPORARY tables
+ERROR HY000: System versioning prohibited for TEMPORARY tables
create or replace table t1 (
x29 int unsigned,
Sys_start0 timestamp(6) as row start invisible,
diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test
index 4118b5bf5c3..bac27cb940d 100644
--- a/mysql-test/suite/versioning/t/alter.test
+++ b/mysql-test/suite/versioning/t/alter.test
@@ -364,10 +364,12 @@ 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_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN
+--error ER_VERS_TEMPORARY
alter table t change column if exists b c bigint unsigned generated always as row start;
---error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN
+--error ER_VERS_TEMPORARY
alter table t change column if exists b c bigint unsigned generated always as row end;
+--error ER_VERS_TEMPORARY
+alter table t add system versioning;
drop table t;
--echo # MDEV-14744 trx_id-based and transaction-based mixup in assertion
diff --git a/sql/handler.cc b/sql/handler.cc
index 5cbcd936216..60909ba2299 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -7177,6 +7177,12 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
if (!need_check(alter_info) && !share->versioned)
return false;
+ if (!thd->variables.vers_force && share->tmp_table && share->tmp_table != INTERNAL_TMP_TABLE)
+ {
+ my_error(ER_VERS_TEMPORARY, MYF(0));
+ return true;
+ }
+
if (alter_info->flags & Alter_info::ALTER_ADD_SYSTEM_VERSIONING && table->versioned())
{
my_error(ER_VERS_ALREADY_VERSIONED, MYF(0), table_name);
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 6380305fb0e..ebf149fd6e7 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7931,7 +7931,7 @@ ER_VERS_TRUNCATE_VIEW
eng "DELETE HISTORY from VIEW is prohibited"
ER_VERS_TEMPORARY
- eng "%s prohibited for TEMPORARY tables"
+ eng "System versioning prohibited for TEMPORARY tables"
ER_VERS_INPLACE_NOT_IMPLEMENTED
eng "Not implemented for system-versioned tables"
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 4967065d7ee..68cf1e26084 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -6235,7 +6235,7 @@ versioning_option:
{
if (!thd->variables.vers_force)
{
- my_error(ER_VERS_TEMPORARY, MYF(0), "WITH SYSTEM VERSIONING");
+ my_error(ER_VERS_TEMPORARY, MYF(0));
MYSQL_YYABORT;
}
}