mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
bugfix: non-deterministic vcols in partitioning
This commit is contained in:
@@ -126,3 +126,14 @@ select * from t1;
|
||||
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Restrictions when partitioned
|
||||
#
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
create table t1 (a int, b datetime as (now())) partition by hash(b+1) partitions 3;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
create table t1 (a int, b varchar(100) as (user())) partition by hash(b+1) partitions 3;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
create table t1 (a int, b double as (rand())) partition by hash(b+1) partitions 3;
|
||||
|
||||
@@ -81,3 +81,9 @@ p0 1 16384
|
||||
p1 1 16384
|
||||
p2 0 16384
|
||||
drop table t1;
|
||||
create table t1 (a int, b datetime as (now())) partition by hash(b+1) partitions 3;
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
create table t1 (a int, b varchar(100) as (user())) partition by hash(b+1) partitions 3;
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
create table t1 (a int, b double as (rand())) partition by hash(b+1) partitions 3;
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
|
||||
@@ -81,3 +81,9 @@ p0 1 7
|
||||
p1 1 7
|
||||
p2 0 0
|
||||
drop table t1;
|
||||
create table t1 (a int, b datetime as (now())) partition by hash(b+1) partitions 3;
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
create table t1 (a int, b varchar(100) as (user())) partition by hash(b+1) partitions 3;
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
create table t1 (a int, b double as (rand())) partition by hash(b+1) partitions 3;
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
|
||||
@@ -5576,6 +5576,14 @@ bool Item_field::vcol_in_partition_func_processor(void *int_arg)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool Item_field::check_valid_arguments_processor(void *bool_arg)
|
||||
{
|
||||
Virtual_column_info *vcol= field->vcol_info;
|
||||
if (!vcol)
|
||||
return FALSE;
|
||||
return vcol->expr->walk(&Item::check_partition_func_processor, 0, NULL)
|
||||
|| vcol->expr->walk(&Item::check_valid_arguments_processor, 0, NULL);
|
||||
}
|
||||
|
||||
void Item_field::cleanup()
|
||||
{
|
||||
|
||||
@@ -2576,6 +2576,7 @@ public:
|
||||
bool register_field_in_bitmap(void *arg);
|
||||
bool check_partition_func_processor(void *int_arg) {return FALSE;}
|
||||
bool vcol_in_partition_func_processor(void *bool_arg);
|
||||
bool check_valid_arguments_processor(void *bool_arg);
|
||||
bool check_field_expression_processor(void *arg);
|
||||
bool enumerate_field_refs_processor(void *arg);
|
||||
bool update_table_bitmaps_processor(void *arg);
|
||||
|
||||
@@ -3339,6 +3339,8 @@ partititon_err:
|
||||
outparam->file= 0; // For easier error checking
|
||||
outparam->db_stat=0;
|
||||
thd->lex->context_analysis_only= save_context_analysis_only;
|
||||
if (outparam->expr_arena)
|
||||
outparam->expr_arena->free_items();
|
||||
free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root
|
||||
outparam->alias.free();
|
||||
DBUG_RETURN (error);
|
||||
|
||||
Reference in New Issue
Block a user