mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Further sync postgres_fdw's "Relations" output with the rest of EXPLAIN.
EXPLAIN generally only adds schema qualifications to table names when
VERBOSE is specified. In postgres_fdw's "Relations" output, table
names were always so qualified, but that was an implementation
restriction: in the original coding, we didn't have access to the
verbose flag at the time the string was generated. After the code
rearrangement of commit 4526951d5
, we do have that info available
at the right time, so make this output follow the normal rule.
Discussion: https://postgr.es/m/12424.1575168015@sss.pgh.pa.us
This commit is contained in:
@ -2571,7 +2571,6 @@ postgresExplainForeignScan(ForeignScanState *node, ExplainState *es)
|
||||
{
|
||||
int rti = strtol(ptr, &ptr, 10);
|
||||
RangeTblEntry *rte;
|
||||
char *namespace;
|
||||
char *relname;
|
||||
char *refname;
|
||||
|
||||
@ -2580,11 +2579,19 @@ postgresExplainForeignScan(ForeignScanState *node, ExplainState *es)
|
||||
rte = rt_fetch(rti, es->rtable);
|
||||
Assert(rte->rtekind == RTE_RELATION);
|
||||
/* This logic should agree with explain.c's ExplainTargetRel */
|
||||
namespace = get_namespace_name(get_rel_namespace(rte->relid));
|
||||
relname = get_rel_name(rte->relid);
|
||||
appendStringInfo(relations, "%s.%s",
|
||||
quote_identifier(namespace),
|
||||
quote_identifier(relname));
|
||||
if (es->verbose)
|
||||
{
|
||||
char *namespace;
|
||||
|
||||
namespace = get_namespace_name(get_rel_namespace(rte->relid));
|
||||
appendStringInfo(relations, "%s.%s",
|
||||
quote_identifier(namespace),
|
||||
quote_identifier(relname));
|
||||
}
|
||||
else
|
||||
appendStringInfo(relations, "%s",
|
||||
quote_identifier(relname));
|
||||
refname = (char *) list_nth(es->rtable_names, rti - 1);
|
||||
if (refname == NULL)
|
||||
refname = rte->eref->aliasname;
|
||||
|
Reference in New Issue
Block a user