mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
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.
This commit is contained in:
@ -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 */
|
||||
|
Reference in New Issue
Block a user