aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/parser/gram.y23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 7a854e364d3..aead8ec2248 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -10634,6 +10634,29 @@ c_expr: columnref { $$ = $1; }
n->location = @1;
$$ = (Node *)n;
}
+ | select_with_parens indirection
+ {
+ /*
+ * Because the select_with_parens nonterminal is designed
+ * to "eat" as many levels of parens as possible, the
+ * '(' a_expr ')' opt_indirection production above will
+ * fail to match a sub-SELECT with indirection decoration;
+ * the sub-SELECT won't be regarded as an a_expr as long
+ * as there are parens around it. To support applying
+ * subscripting or field selection to a sub-SELECT result,
+ * we need this redundant-looking production.
+ */
+ SubLink *n = makeNode(SubLink);
+ A_Indirection *a = makeNode(A_Indirection);
+ n->subLinkType = EXPR_SUBLINK;
+ n->testexpr = NULL;
+ n->operName = NIL;
+ n->subselect = $1;
+ n->location = @1;
+ a->arg = (Node *)n;
+ a->indirection = check_indirection($2, yyscanner);
+ $$ = (Node *)a;
+ }
| EXISTS select_with_parens
{
SubLink *n = makeNode(SubLink);