aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/explain.c14
-rw-r--r--src/backend/commands/typecmds.c15
2 files changed, 10 insertions, 19 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 33252a8e205..323f3a11ae9 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -653,9 +653,9 @@ elapsed_time(instr_time *starttime)
* Prescan the planstate tree to identify which RTEs are referenced
*
* Adds the relid of each referenced RTE to *rels_used. The result controls
- * which RTEs are assigned aliases by select_rtable_names_for_explain. This
- * ensures that we don't confusingly assign un-suffixed aliases to RTEs that
- * never appear in the EXPLAIN output (such as inheritance parents).
+ * which RTEs are assigned aliases by select_rtable_names_for_explain.
+ * This ensures that we don't confusingly assign un-suffixed aliases to RTEs
+ * that never appear in the EXPLAIN output (such as inheritance parents).
*/
static void
ExplainPreScanNode(PlanState *planstate, Bitmapset **rels_used)
@@ -1954,6 +1954,8 @@ ExplainTargetRel(Plan *plan, Index rti, ExplainState *es)
rte = rt_fetch(rti, es->rtable);
refname = (char *) list_nth(es->rtable_names, rti - 1);
+ if (refname == NULL)
+ refname = rte->eref->aliasname;
switch (nodeTag(plan))
{
@@ -2026,8 +2028,7 @@ ExplainTargetRel(Plan *plan, Index rti, ExplainState *es)
quote_identifier(objectname));
else if (objectname != NULL)
appendStringInfo(es->str, " %s", quote_identifier(objectname));
- if (refname != NULL &&
- (objectname == NULL || strcmp(refname, objectname) != 0))
+ if (objectname == NULL || strcmp(refname, objectname) != 0)
appendStringInfo(es->str, " %s", quote_identifier(refname));
}
else
@@ -2036,8 +2037,7 @@ ExplainTargetRel(Plan *plan, Index rti, ExplainState *es)
ExplainPropertyText(objecttag, objectname, es);
if (namespace != NULL)
ExplainPropertyText("Schema", namespace, es);
- if (refname != NULL)
- ExplainPropertyText("Alias", refname, es);
+ ExplainPropertyText("Alias", refname, es);
}
}
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index aca670095b9..e859379cb95 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -888,9 +888,7 @@ DefineDomain(CreateDomainStmt *stmt)
*/
defaultValue =
deparse_expression(defaultExpr,
- deparse_context_for(domainName,
- InvalidOid),
- false, false);
+ NIL, false, false);
defaultValueBin = nodeToString(defaultExpr);
}
}
@@ -2143,9 +2141,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
* easier for pg_dump).
*/
defaultValue = deparse_expression(defaultExpr,
- deparse_context_for(NameStr(typTup->typname),
- InvalidOid),
- false, false);
+ NIL, false, false);
/*
* Form an updated tuple with the new default and write it back.
@@ -2941,14 +2937,9 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
/*
* Deparse it to produce text for consrc.
- *
- * Since VARNOs aren't allowed in domain constraints, relation context
- * isn't required as anything other than a shell.
*/
ccsrc = deparse_expression(expr,
- deparse_context_for(domainName,
- InvalidOid),
- false, false);
+ NIL, false, false);
/*
* Store the constraint in pg_constraint