]> granicus.if.org Git - postgresql/blobdiff - src/backend/parser/parse_utilcmd.c
Improve error handling of column references in expression transformation
[postgresql] / src / backend / parser / parse_utilcmd.c
index b4ec96d6d6d0dee119adb3cf9aa5a3f8c6b945eb..443b70192d9ba729486dd78e6e7902e83be04631 100644 (file)
@@ -3926,12 +3926,12 @@ transformPartitionBoundValue(ParseState *pstate, Node *val,
        if (!IsA(value, Const))
                value = (Node *) expression_planner((Expr *) value);
 
-       /* Make sure the expression does not refer to any vars. */
-       if (contain_var_clause(value))
-               ereport(ERROR,
-                               (errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
-                                errmsg("cannot use column references in partition bound expression"),
-                                parser_errposition(pstate, exprLocation(value))));
+       /*
+        * transformExpr() should have already rejected column references,
+        * subqueries, aggregates, window functions, and SRFs, based on the
+        * EXPR_KIND_ for a default expression.
+        */
+       Assert(!contain_var_clause(value));
 
        /*
         * Evaluate the expression, assigning the partition key's collation to the