Commit 912769b7 authored by Aleksey Midenkov's avatar Aleksey Midenkov

SQL: lower priority of warning in vers_part_rotate() for ALTER [fixes #446]

parent daf883f9
......@@ -251,6 +251,15 @@ x
3
4
5
### Assertion in ALTER on warning from partitioning LIMIT [#446]
create or replace table t1 (x int) with system versioning;
insert into t1 values (1), (2);
delete from t1;
alter table t1 partition by system_time limit 1 (
partition p1 history,
partition pn current);
Warnings:
Note 4113 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
## rotation by INTERVAL
create or replace table t1 (x int)
with system versioning
......
......@@ -216,6 +216,14 @@ insert into t1 values (4), (5);
delete from t1;
select * from t1 partition (p1) order by x;
--echo ### Assertion in ALTER on warning from partitioning LIMIT [#446]
create or replace table t1 (x int) with system versioning;
insert into t1 values (1), (2);
delete from t1;
alter table t1 partition by system_time limit 1 (
partition p1 history,
partition pn current);
--echo ## rotation by INTERVAL
--error ER_PART_WRONG_VALUE
create or replace table t1 (x int)
......
......@@ -897,10 +897,12 @@ partition_info::vers_part_rotate(THD * thd)
{
DBUG_ASSERT(table->s->hist_part_id == vers_info->now_part->id - 1);
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
thd->lex->sql_command == SQLCOM_ALTER_TABLE ?
Sql_condition::WARN_LEVEL_NOTE :
Sql_condition::WARN_LEVEL_WARN,
WARN_VERS_PART_FULL,
ER_THD(thd, WARN_VERS_PART_FULL),
table->s->db.str, table->s->table_name.str,
table->s->db.str, table->s->error_table_name(),
vers_info->hist_part->partition_name);
return vers_info->hist_part;
}
......@@ -913,7 +915,7 @@ partition_info::vers_part_rotate(THD * thd)
Sql_condition::WARN_LEVEL_NOTE,
WARN_VERS_PART_ROTATION,
ER_THD(thd, WARN_VERS_PART_ROTATION),
table->s->db.str, table->s->table_name.str,
table->s->db.str, table->s->error_table_name(),
old_part_name,
vers_info->hist_part->partition_name);
......
......@@ -9780,6 +9780,7 @@ bool mysql_alter_table(THD *thd, const char *new_db, const char *new_name,
}
if (!new_table)
goto err_new_table_cleanup;
new_table->s->orig_table_name= table->s->table_name.str;
new_versioned= new_table->versioned();
/*
Note: In case of MERGE table, we do not attach children. We do not
......
......@@ -648,6 +648,16 @@ struct TABLE_SHARE
LEX_CSTRING normalized_path; /* unpack_filename(path) */
LEX_CSTRING connect_string;
const char* orig_table_name; /* Original table name for this tmp table */
const char* error_table_name() const /* Get table name for error messages */
{
return tmp_table ? (
orig_table_name ?
orig_table_name :
"(temporary)") :
table_name.str;
}
/*
Set of keys in use, implemented as a Bitmap.
Excludes keys disabled by ALTER TABLE ... DISABLE KEYS.
......
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