summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-01-29 10:28:03 +0100
committerTom Lane <tgl@sss.pgh.pa.us>2016-01-29 10:28:03 +0100
commita362cc2e3528c183de72863d2779912b0323ee4b (patch)
tree27b1e52dbfed58908b3002780deae6d26593b0bb
parent3a7af9d73b8f48d49837633ae07cf8c15b48ddd9 (diff)
Fix incorrect pattern-match processing in psql's \det command.
listForeignTables' invocation of processSQLNamePattern did not match up with the other ones that handle potentially-schema-qualified names; it failed to make use of pg_table_is_visible() and also passed the name arguments in the wrong order. Bug seems to have been aboriginal in commit 0d692a0dc9f0e532. It accidentally sort of worked as long as you didn't inquire too closely into the behavior, although the silliness was later exposed by inconsistencies in the test queries added by 59efda3e50ca4de6 (which I probably should have questioned at the time, but didn't). Per bug #13899 from Reece Hart. Patch by Reece Hart and Tom Lane. Back-patch to all affected branches.
-rw-r--r--src/bin/psql/describe.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index fcbd268d2c9..3e19ce4386c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -4028,7 +4028,8 @@ listForeignTables(const char *pattern, bool verbose)
"d.objoid = c.oid AND d.objsubid = 0\n");
processSQLNamePattern(pset.db, &buf, pattern, false, false,
- NULL, "n.nspname", "c.relname", NULL);
+ "n.nspname", "c.relname", NULL,
+ "pg_catalog.pg_table_is_visible(c.oid)");
appendPQExpBuffer(&buf, "ORDER BY 1, 2;");