Skip to content

Commit d4b49b4

Browse files
committed
Avoid generating excess (and illegal) parentheses around an aliased JOIN
in prettyprint mode. Andreas Pflug
1 parent cda3e58 commit d4b49b4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/utils/adt/ruleutils.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* back to source text
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.186 2004/12/11 23:26:45 tgl Exp $
6+
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.187 2004/12/13 00:33:06 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -3903,7 +3903,8 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
39033903
bool need_paren_on_right;
39043904

39053905
need_paren_on_right = PRETTY_PAREN(context) &&
3906-
!IsA(j->rarg, RangeTblRef);
3906+
!IsA(j->rarg, RangeTblRef) &&
3907+
!(IsA(j->rarg, JoinExpr) && ((JoinExpr*) j->rarg)->alias != NULL);
39073908

39083909
if (!PRETTY_PAREN(context) || j->alias != NULL)
39093910
appendStringInfoChar(buf, '(');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy