From bf39b3af6a9c6a036aae0742cf339fce662eee3a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 3 Dec 2019 12:25:56 -0500 Subject: 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 --- contrib/postgres_fdw/postgres_fdw.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'contrib/postgres_fdw/postgres_fdw.c') 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; -- cgit v1.2.3