On Mon, Oct 24, 2022 at 09:44:18PM +0900, Ian Lawrence Barwick wrote: > Recently I have been working a lot with partitioned tables which contain a mix > of local and foreign partitions, and find it would be very useful to be able > to > easily obtain an overview of which partitions are foreign and where they are > located.
> Partitions: parttest_10_0 FOR VALUES WITH (modulus 10, remainder 0), > parttest_10_1 FOR VALUES WITH (modulus 10, remainder 1), > server: "fdw_node2", > which is much more informative, albeit a little more cluttered, but > @@ -3445,6 +3451,10 @@ describeOneTableDetails(const char *schemaname, > if (child_relkind == RELKIND_PARTITIONED_TABLE > || > child_relkind == > RELKIND_PARTITIONED_INDEX) > appendPQExpBufferStr(&buf, ", > PARTITIONED"); > + else if (child_relkind == RELKIND_FOREIGN_TABLE > && is_partitioned) > + appendPQExpBuffer(&buf, ", server: > \"%s\"", PQgetvalue(result, i, 4)); > + else if (child_relkind == RELKIND_FOREIGN_TABLE > && !is_partitioned) > + appendPQExpBuffer(&buf, " (server: > \"%s\")", PQgetvalue(result, i, 4)); > if (strcmp(PQgetvalue(result, i, 2), "t") == 0) > appendPQExpBufferStr(&buf, " (DETACH > PENDING)"); > if (i < tuples - 1) To avoid the clutter that you mentioned, I suggest that this should show that the table *is* foreign, but without the server - if you want to know the server (or its options), you can run another \d command for that (or run a SQL query). That's similar to what's shown if the child is partitioned: a suffix like ", PARTITIONED", but without show the partition strategy. I had a patch to allow \d++, and maybe showing the foreign server would be reasonable for that. But the patch got closed, evidently lack of interest.