aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/commands/functioncmds.c2
-rw-r--r--src/backend/parser/parse_agg.c10
-rw-r--r--src/backend/parser/parse_clause.c11
-rw-r--r--src/backend/parser/parse_expr.c6
-rw-r--r--src/backend/parser/parse_func.c2
-rw-r--r--src/include/parser/parse_node.h2
-rw-r--r--src/test/regress/expected/create_table.out4
7 files changed, 19 insertions, 18 deletions
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index a483714766d..5d94c1ca27c 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -2225,7 +2225,7 @@ ExecuteCallStmt(ParseState *pstate, CallStmt *stmt, bool atomic)
{
targs = lappend(targs, transformExpr(pstate,
(Node *) lfirst(lc),
- EXPR_KIND_CALL));
+ EXPR_KIND_CALL_ARGUMENT));
}
node = ParseFuncOrColumn(pstate,
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 747139489a0..377a7ed6d0a 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -509,13 +509,13 @@ check_agglevels_and_constraints(ParseState *pstate, Node *expr)
break;
case EXPR_KIND_PARTITION_EXPRESSION:
if (isAgg)
- err = _("aggregate functions are not allowed in partition key expression");
+ err = _("aggregate functions are not allowed in partition key expressions");
else
- err = _("grouping operations are not allowed in partition key expression");
+ err = _("grouping operations are not allowed in partition key expressions");
break;
- case EXPR_KIND_CALL:
+ case EXPR_KIND_CALL_ARGUMENT:
if (isAgg)
err = _("aggregate functions are not allowed in CALL arguments");
else
@@ -897,9 +897,9 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
err = _("window functions are not allowed in trigger WHEN conditions");
break;
case EXPR_KIND_PARTITION_EXPRESSION:
- err = _("window functions are not allowed in partition key expression");
+ err = _("window functions are not allowed in partition key expressions");
break;
- case EXPR_KIND_CALL:
+ case EXPR_KIND_CALL_ARGUMENT:
err = _("window functions are not allowed in CALL arguments");
break;
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index 9bafc24083b..3a02307bd99 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -3106,12 +3106,11 @@ resolve_unique_index_expr(ParseState *pstate, InferClause *infer,
}
/*
- * transformExpr() should have already rejected subqueries,
- * aggregates, and window functions, based on the EXPR_KIND_ for an
- * index expression. Expressions returning sets won't have been
- * rejected, but don't bother doing so here; there should be no
- * available expression unique index to match any such expression
- * against anyway.
+ * transformExpr() will reject subqueries, aggregates, window
+ * functions, and SRFs, based on being passed
+ * EXPR_KIND_INDEX_EXPRESSION. So we needn't worry about those
+ * further ... not that they would match any available index
+ * expression anyway.
*/
pInfer->expr = transformExpr(pstate, parse, EXPR_KIND_INDEX_EXPRESSION);
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index d45926f27fd..385e54a9b69 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -1818,7 +1818,6 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
case EXPR_KIND_RETURNING:
case EXPR_KIND_VALUES:
case EXPR_KIND_VALUES_SINGLE:
- case EXPR_KIND_CALL:
/* okay */
break;
case EXPR_KIND_CHECK_CONSTRAINT:
@@ -1847,6 +1846,9 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
case EXPR_KIND_PARTITION_EXPRESSION:
err = _("cannot use subquery in partition key expression");
break;
+ case EXPR_KIND_CALL_ARGUMENT:
+ err = _("cannot use subquery in CALL argument");
+ break;
/*
* There is intentionally no default: case here, so that the
@@ -3471,7 +3473,7 @@ ParseExprKindName(ParseExprKind exprKind)
return "WHEN";
case EXPR_KIND_PARTITION_EXPRESSION:
return "PARTITION BY";
- case EXPR_KIND_CALL:
+ case EXPR_KIND_CALL_ARGUMENT:
return "CALL";
/*
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 4a7bc77c0f7..2a4ac09d5c9 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -2290,7 +2290,7 @@ check_srf_call_placement(ParseState *pstate, Node *last_srf, int location)
case EXPR_KIND_PARTITION_EXPRESSION:
err = _("set-returning functions are not allowed in partition key expressions");
break;
- case EXPR_KIND_CALL:
+ case EXPR_KIND_CALL_ARGUMENT:
err = _("set-returning functions are not allowed in CALL arguments");
break;
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index 2e0792d60b0..0230543810f 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -69,7 +69,7 @@ typedef enum ParseExprKind
EXPR_KIND_TRIGGER_WHEN, /* WHEN condition in CREATE TRIGGER */
EXPR_KIND_POLICY, /* USING or WITH CHECK expr in policy */
EXPR_KIND_PARTITION_EXPRESSION, /* PARTITION BY expression */
- EXPR_KIND_CALL /* CALL argument */
+ EXPR_KIND_CALL_ARGUMENT /* procedure argument in CALL */
} ParseExprKind;
diff --git a/src/test/regress/expected/create_table.out b/src/test/regress/expected/create_table.out
index f5e56365f58..bef5463bab5 100644
--- a/src/test/regress/expected/create_table.out
+++ b/src/test/regress/expected/create_table.out
@@ -325,12 +325,12 @@ DROP FUNCTION retset(int);
CREATE TABLE partitioned (
a int
) PARTITION BY RANGE ((avg(a)));
-ERROR: aggregate functions are not allowed in partition key expression
+ERROR: aggregate functions are not allowed in partition key expressions
CREATE TABLE partitioned (
a int,
b int
) PARTITION BY RANGE ((avg(a) OVER (PARTITION BY b)));
-ERROR: window functions are not allowed in partition key expression
+ERROR: window functions are not allowed in partition key expressions
CREATE TABLE partitioned (
a int
) PARTITION BY LIST ((a LIKE (SELECT 1)));