From d4b49b4bd4fb8a32b5da7d28bfe36d453ebdd4c0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 13 Dec 2004 00:33:06 +0000 Subject: [PATCH] Avoid generating excess (and illegal) parentheses around an aliased JOIN in prettyprint mode. Andreas Pflug --- src/backend/utils/adt/ruleutils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 44fdafcded..4cd5cd6972 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -3,7 +3,7 @@ * back to source text * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.186 2004/12/11 23:26:45 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.187 2004/12/13 00:33:06 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -3903,7 +3903,8 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context) bool need_paren_on_right; need_paren_on_right = PRETTY_PAREN(context) && - !IsA(j->rarg, RangeTblRef); + !IsA(j->rarg, RangeTblRef) && + !(IsA(j->rarg, JoinExpr) && ((JoinExpr*) j->rarg)->alias != NULL); if (!PRETTY_PAREN(context) || j->alias != NULL) appendStringInfoChar(buf, '('); -- 2.40.0