tweak-ruleutils-column-name-rule.patch

text/x-diff

Filename: tweak-ruleutils-column-name-rule.patch
Type: text/x-diff
Part: 0
Message: Re: BUG #17486: [pg_restore] Restoring a view fails if this view contains an attribute without alias name.

Patch

Format: unified
File+
src/backend/utils/adt/ruleutils.c 2 2
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 49c4201dde..41275d39b3 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -6042,8 +6042,8 @@ get_target_list(List *targetList, deparse_context *context,
 		else
 		{
 			get_rule_expr((Node *) tle->expr, context, true);
-			/* We'll show the AS name unless it's this: */
-			attname = "?column?";
+			/* Always show the assigned column name explicitly. */
+			attname = NULL;
 		}
 
 		/*