!4490 修复分区建支持表达式的core问题
Merge pull request !4490 from pengjiong/fix_case
This commit is contained in:
@ -31913,11 +31913,15 @@ static void CheckPartitionExpr(Node* expr, int* colCount)
|
||||
if (expr == NULL)
|
||||
ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("The expr can't be NULL")));
|
||||
if (expr->type == T_A_Expr) {
|
||||
char* name = strVal(linitial(((A_Expr*)expr)->name));
|
||||
A_Expr* a_expr = (A_Expr*)expr;
|
||||
if (a_expr->name == NULL) {
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("The expr is not supported for Partition Expr")));
|
||||
}
|
||||
char* name = strVal(linitial(a_expr->name));
|
||||
if (strcmp(name, "+") != 0 && strcmp(name, "-") != 0 && strcmp(name, "*") != 0)
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("The %s operator is not supported for Partition Expr", name)));
|
||||
CheckPartitionExpr(((A_Expr*)expr)->lexpr, colCount);
|
||||
CheckPartitionExpr(((A_Expr*)expr)->rexpr, colCount);
|
||||
CheckPartitionExpr(a_expr->lexpr, colCount);
|
||||
CheckPartitionExpr(a_expr->rexpr, colCount);
|
||||
} else if (expr->type == T_FuncCall) {
|
||||
char* validFuncName[MAX_SUPPORTED_FUNC_FOR_PART_EXPR] = {"abs","ceiling","datediff","day","dayofmonth","dayofweek","dayofyear","extract","floor","hour",
|
||||
"microsecond","minute","mod","month","quarter","second","time_to_sec","to_days","to_seconds","unix_timestamp","weekday","year","yearweek","date_part","div"};
|
||||
|
||||
@ -10,6 +10,7 @@ create table testlistpart(a int, b int) partition by list(int4mul(a,2)) (partiti
|
||||
create table testhashpart(a int, b int) partition by hash(int4mul(a,2)) (partition p0 ,partition p1);
|
||||
create table testrangepart(a int, b int) partition by range(a,b*2) (partition p0 values less than(100,1000),partition p1 values less than(200,2000));
|
||||
create table testrangepart(a int, b int) partition by range(a*2,b) (partition p0 values less than(100,1000),partition p1 values less than(200,2000));
|
||||
CREATE TABLE test_error_table0 ( column62 INT ) PARTITION BY HASH ( NOT TRUE ) ;
|
||||
CREATE TABLE testrangepart(a date) PARTITION BY RANGE (a*2) INTERVAL ('1 month')
|
||||
(
|
||||
PARTITION p0 VALUES LESS THAN ('2020-03-01'),
|
||||
|
||||
@ -19,6 +19,8 @@ create table testrangepart(a int, b int) partition by range(a,b*2) (partition p0
|
||||
ERROR: The multi partition expr keys are not supported.
|
||||
create table testrangepart(a int, b int) partition by range(a*2,b) (partition p0 values less than(100,1000),partition p1 values less than(200,2000));
|
||||
ERROR: The multi partition expr keys are not supported.
|
||||
CREATE TABLE test_error_table0 ( column62 INT ) PARTITION BY HASH ( NOT TRUE ) ;
|
||||
ERROR: The expr is not supported for Partition Expr
|
||||
CREATE TABLE testrangepart(a date) PARTITION BY RANGE (a*2) INTERVAL ('1 month')
|
||||
(
|
||||
PARTITION p0 VALUES LESS THAN ('2020-03-01'),
|
||||
|
||||
Reference in New Issue
Block a user