summaryrefslogtreecommitdiff
path: root/src/backend/commands/policy.c
diff options
context:
space:
mode:
authorJoe Conway <mail@joeconway.com>2015-07-29 15:41:00 -0700
committerJoe Conway <mail@joeconway.com>2015-07-29 15:41:00 -0700
commit43797ed42a7c0365c9143ad6efdc566ac9d93fd8 (patch)
treefc04f3dc24120507a592fbf859b97d7eebdfc3c5 /src/backend/commands/policy.c
parent3ef1a682d5e4a919dcaddc8256ea65de91654d1c (diff)
Create new ParseExprKind for use by policy expressions.
Policy USING and WITH CHECK expressions were using EXPR_KIND_WHERE for parse analysis, which results in inappropriate ERROR messages when the expression contains unsupported constructs such as aggregates. Create a new ParseExprKind called EXPR_KIND_POLICY and tailor the related messages to fit. Reported by Noah Misch. Reviewed by Dean Rasheed, Alvaro Herrera, and Robert Haas. Back-patch to 9.5 where RLS was introduced.
Diffstat (limited to 'src/backend/commands/policy.c')
-rw-r--r--src/backend/commands/policy.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c
index d8b43908ec4..bcf4a8f35d1 100644
--- a/src/backend/commands/policy.c
+++ b/src/backend/commands/policy.c
@@ -534,12 +534,12 @@ CreatePolicy(CreatePolicyStmt *stmt)
qual = transformWhereClause(qual_pstate,
copyObject(stmt->qual),
- EXPR_KIND_WHERE,
+ EXPR_KIND_POLICY,
"POLICY");
with_check_qual = transformWhereClause(with_check_pstate,
copyObject(stmt->with_check),
- EXPR_KIND_WHERE,
+ EXPR_KIND_POLICY,
"POLICY");
/* Fix up collation information */
@@ -707,7 +707,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
addRTEtoQuery(qual_pstate, rte, false, true, true);
qual = transformWhereClause(qual_pstate, copyObject(stmt->qual),
- EXPR_KIND_WHERE,
+ EXPR_KIND_POLICY,
"POLICY");
/* Fix up collation information */
@@ -730,7 +730,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
with_check_qual = transformWhereClause(with_check_pstate,
copyObject(stmt->with_check),
- EXPR_KIND_WHERE,
+ EXPR_KIND_POLICY,
"POLICY");
/* Fix up collation information */