mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
SQL: partitioning CREATE, ALTER fixes
MDEV-14688 Assertion `tab_part_info->part_type == LIST_PARTITION' failed in prep_alter_part_table MDEV-14673 Assertion `part_elem->type() == partition_element::AS_OF_NOW' failed in check_partition_info
This commit is contained in:
@ -32,8 +32,7 @@ x
|
|||||||
create or replace table t1 (i int) engine=DEFAULT_ENGINE with system versioning partition by hash(i);
|
create or replace table t1 (i int) engine=DEFAULT_ENGINE with system versioning partition by hash(i);
|
||||||
alter table t1 engine=NON_DEFAULT_ENGINE;
|
alter table t1 engine=NON_DEFAULT_ENGINE;
|
||||||
ERROR HY000: Not allowed for system-versioned `test`.`t1`. Change to/from native system versioning engine is prohibited.
|
ERROR HY000: Not allowed for system-versioned `test`.`t1`. Change to/from native system versioning engine is prohibited.
|
||||||
# Check server-level partitioning
|
## CREATE TABLE
|
||||||
## create errors
|
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
partition p0 history,
|
partition p0 history,
|
||||||
@ -49,34 +48,40 @@ create or replace table t1 (x int)
|
|||||||
with system versioning
|
with system versioning
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
partition p0 current);
|
partition p0 current);
|
||||||
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
with system versioning
|
with system versioning
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
partition p0 current,
|
partition p0 current,
|
||||||
partition p1 current);
|
partition p1 current);
|
||||||
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
with system versioning
|
with system versioning
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
partition p0 history,
|
partition p0 history,
|
||||||
partition p1 history);
|
partition p1 history);
|
||||||
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
with system versioning
|
with system versioning
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
partition pn current,
|
partition pn current,
|
||||||
partition p0 history);
|
partition p0 history);
|
||||||
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
||||||
|
create or replace table t1 (x int)
|
||||||
|
with system versioning
|
||||||
|
partition by system_time (
|
||||||
|
partition p0,
|
||||||
|
partition pn current);
|
||||||
|
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
with system versioning
|
with system versioning
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
partition p0 history,
|
partition p0 history,
|
||||||
partition pn current);
|
partition pn current);
|
||||||
## alter table
|
## ALTER TABLE
|
||||||
alter table t1 add partition (
|
alter table t1 add partition (
|
||||||
partition p1 current);
|
partition p1 current);
|
||||||
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
||||||
alter table t1 add partition (
|
alter table t1 add partition (
|
||||||
partition p1 history);
|
partition p1 history);
|
||||||
Warnings:
|
Warnings:
|
||||||
@ -95,10 +100,10 @@ t1 CREATE TABLE `t1` (
|
|||||||
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
|
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
|
||||||
insert into t1 values (1), (2);
|
insert into t1 values (1), (2);
|
||||||
alter table t1 drop partition pn;
|
alter table t1 drop partition pn;
|
||||||
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
||||||
alter table t1 drop partition p1;
|
alter table t1 drop partition p1;
|
||||||
alter table t1 drop partition p0;
|
alter table t1 drop partition p0;
|
||||||
ERROR HY000: Wrong partitions consistency for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
|
||||||
select x from t1;
|
select x from t1;
|
||||||
x
|
x
|
||||||
1
|
1
|
||||||
@ -110,7 +115,10 @@ partition by system_time limit 1 (
|
|||||||
partition p0 history,
|
partition p0 history,
|
||||||
partition pn current);
|
partition pn current);
|
||||||
alter table t1 change x big int;
|
alter table t1 change x big int;
|
||||||
## insert, delete, update
|
create or replace table t1 (i int) engine myisam partition by hash(i) partitions 2;
|
||||||
|
alter table t1 add partition (partition px history);
|
||||||
|
ERROR HY000: Wrong partitioning type, expected type: `SYSTEM_TIME`
|
||||||
|
## INSERT, UPDATE, DELETE
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
with system versioning
|
with system versioning
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
|
@ -27,8 +27,9 @@ eval create or replace table t1 (i int) engine=$default_engine with system versi
|
|||||||
--error ER_VERS_ALTER_ENGINE_PROHIBITED
|
--error ER_VERS_ALTER_ENGINE_PROHIBITED
|
||||||
eval alter table t1 engine=$non_default_engine;
|
eval alter table t1 engine=$non_default_engine;
|
||||||
|
|
||||||
--echo # Check server-level partitioning
|
|
||||||
--echo ## create errors
|
--echo ## CREATE TABLE
|
||||||
|
|
||||||
--error ER_VERS_ENGINE_UNSUPPORTED
|
--error ER_VERS_ENGINE_UNSUPPORTED
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
@ -69,13 +70,22 @@ partition by system_time (
|
|||||||
partition pn current,
|
partition pn current,
|
||||||
partition p0 history);
|
partition p0 history);
|
||||||
|
|
||||||
|
--error ER_VERS_WRONG_PARTS
|
||||||
|
create or replace table t1 (x int)
|
||||||
|
with system versioning
|
||||||
|
partition by system_time (
|
||||||
|
partition p0,
|
||||||
|
partition pn current);
|
||||||
|
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
with system versioning
|
with system versioning
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
partition p0 history,
|
partition p0 history,
|
||||||
partition pn current);
|
partition pn current);
|
||||||
|
|
||||||
--echo ## alter table
|
|
||||||
|
--echo ## ALTER TABLE
|
||||||
|
|
||||||
--error ER_VERS_WRONG_PARTS
|
--error ER_VERS_WRONG_PARTS
|
||||||
alter table t1 add partition (
|
alter table t1 add partition (
|
||||||
partition p1 current);
|
partition p1 current);
|
||||||
@ -104,7 +114,13 @@ partition by system_time limit 1 (
|
|||||||
partition pn current);
|
partition pn current);
|
||||||
alter table t1 change x big int;
|
alter table t1 change x big int;
|
||||||
|
|
||||||
--echo ## insert, delete, update
|
create or replace table t1 (i int) engine myisam partition by hash(i) partitions 2;
|
||||||
|
--error ER_PARTITION_WRONG_TYPE
|
||||||
|
alter table t1 add partition (partition px history);
|
||||||
|
|
||||||
|
|
||||||
|
--echo ## INSERT, UPDATE, DELETE
|
||||||
|
|
||||||
create or replace table t1 (x int)
|
create or replace table t1 (x int)
|
||||||
with system versioning
|
with system versioning
|
||||||
partition by system_time (
|
partition by system_time (
|
||||||
|
@ -7834,7 +7834,7 @@ ER_NON_VERSIONED_FIELD_IN_VERSIONED_QUERY
|
|||||||
eng "Attempt to read non-temporal field %`s in historical query"
|
eng "Attempt to read non-temporal field %`s in historical query"
|
||||||
|
|
||||||
ER_PARTITION_WRONG_TYPE
|
ER_PARTITION_WRONG_TYPE
|
||||||
eng "Wrong partition type, expected type: %`s"
|
eng "Wrong partitioning type, expected type: %`s"
|
||||||
|
|
||||||
WARN_VERS_PART_FULL
|
WARN_VERS_PART_FULL
|
||||||
eng "Versioned table %`s.%`s: partition %`s is full, add more HISTORY partitions"
|
eng "Versioned table %`s.%`s: partition %`s is full, add more HISTORY partitions"
|
||||||
@ -7897,7 +7897,7 @@ ER_PART_WRONG_VALUE
|
|||||||
eng "Wrong parameters for partitioned %`s: wrong value for '%s'"
|
eng "Wrong parameters for partitioned %`s: wrong value for '%s'"
|
||||||
|
|
||||||
ER_VERS_WRONG_PARTS
|
ER_VERS_WRONG_PARTS
|
||||||
eng "Wrong partitions consistency for %`s: must have at least one HISTORY and exactly one last CURRENT"
|
eng "Wrong partitions for %`s: must have at least one HISTORY and exactly one last CURRENT"
|
||||||
|
|
||||||
ER_VERS_HISTORY_LOCK
|
ER_VERS_HISTORY_LOCK
|
||||||
eng "Versioned SELECT write-locking of history rows"
|
eng "Versioned SELECT write-locking of history rows"
|
||||||
|
@ -4737,6 +4737,10 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
|
|||||||
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
|
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
|
||||||
"LIST", "IN");
|
"LIST", "IN");
|
||||||
}
|
}
|
||||||
|
else if (thd->work_part_info->part_type == VERSIONING_PARTITION)
|
||||||
|
{
|
||||||
|
my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME");
|
||||||
|
}
|
||||||
else if (tab_part_info->part_type == RANGE_PARTITION)
|
else if (tab_part_info->part_type == RANGE_PARTITION)
|
||||||
{
|
{
|
||||||
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
|
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
|
||||||
|
@ -5430,6 +5430,9 @@ opt_part_values:
|
|||||||
if (part_info->part_type == LIST_PARTITION)
|
if (part_info->part_type == LIST_PARTITION)
|
||||||
my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
|
my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
|
||||||
"LIST", "IN"));
|
"LIST", "IN"));
|
||||||
|
if (part_info->part_type == VERSIONING_PARTITION)
|
||||||
|
my_yyabort_error((ER_VERS_WRONG_PARTS, MYF(0),
|
||||||
|
lex->create_last_non_select_table->table_name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
part_info->part_type= HASH_PARTITION;
|
part_info->part_type= HASH_PARTITION;
|
||||||
@ -5470,8 +5473,7 @@ opt_part_values:
|
|||||||
if (! lex->is_partition_management())
|
if (! lex->is_partition_management())
|
||||||
{
|
{
|
||||||
if (part_info->part_type != VERSIONING_PARTITION)
|
if (part_info->part_type != VERSIONING_PARTITION)
|
||||||
my_yyabort_error((ER_PARTITION_WRONG_TYPE, MYF(0),
|
my_yyabort_error((ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME"));
|
||||||
"BY SYSTEM_TIME"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -5497,8 +5499,7 @@ opt_part_values:
|
|||||||
if (! lex->is_partition_management())
|
if (! lex->is_partition_management())
|
||||||
{
|
{
|
||||||
if (part_info->part_type != VERSIONING_PARTITION)
|
if (part_info->part_type != VERSIONING_PARTITION)
|
||||||
my_yyabort_error((ER_PARTITION_WRONG_TYPE, MYF(0),
|
my_yyabort_error((ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME"));
|
||||||
"BY SYSTEM_TIME"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user