diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-05-14 11:43:14 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-05-14 12:14:17 -0400 |
commit | 93316299d6a185bed0a4be5376508fe2f7e6b2d6 (patch) | |
tree | c29693203d5f51dd2bb0e95d663931ba4c3cefca | |
parent | 60e2d9ab1437c8e4b12e7766198cf2e84f7d267e (diff) | |
download | postgresql-93316299d6a185bed0a4be5376508fe2f7e6b2d6.tar.gz postgresql-93316299d6a185bed0a4be5376508fe2f7e6b2d6.zip |
psql: have \d show FKs on partitioned tables
Commit 3de241dba86f missed to update psql to display foreign keys on
partitioned tables. Add that.
Reported-by: Amit Langote
Author: Amit Langote
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/a66879e5-636f-d4dd-b4a4-92bdca5a828f@lab.ntt.co.jp
-rw-r--r-- | src/bin/psql/describe.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 410131e5c72..e5b3c1ebf9a 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -2311,8 +2311,13 @@ describeOneTableDetails(const char *schemaname, PQclear(result); } - /* print foreign-key constraints (there are none if no triggers) */ - if (tableinfo.hastriggers) + /* + * Print foreign-key constraints (there are none if no triggers, + * except if the table is partitioned, in which case the triggers + * appear in the partitions) + */ + if (tableinfo.hastriggers || + tableinfo.relkind == RELKIND_PARTITIONED_TABLE) { printfPQExpBuffer(&buf, "SELECT conname,\n" |