diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-12-03 12:25:56 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-12-03 12:25:56 -0500 |
commit | bf39b3af6a9c6a036aae0742cf339fce662eee3a (patch) | |
tree | 0ddb10789aab3dc202a38123a710c8bb85a98bf1 /contrib/postgres_fdw/postgres_fdw.c | |
parent | 68ab982906187fba3530a01b01eb065ea9134298 (diff) | |
download | postgresql-bf39b3af6a9c6a036aae0742cf339fce662eee3a.tar.gz postgresql-bf39b3af6a9c6a036aae0742cf339fce662eee3a.zip |
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
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 3eb4e4044d4..bdc21b36d1e 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -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; |