Skip to content

Commit 9331629

Browse files
committed
psql: have \d show FKs on partitioned tables
Commit 3de241d 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
1 parent 60e2d9a commit 9331629

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/bin/psql/describe.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,8 +2311,13 @@ describeOneTableDetails(const char *schemaname,
23112311
PQclear(result);
23122312
}
23132313

2314-
/* print foreign-key constraints (there are none if no triggers) */
2315-
if (tableinfo.hastriggers)
2314+
/*
2315+
* Print foreign-key constraints (there are none if no triggers,
2316+
* except if the table is partitioned, in which case the triggers
2317+
* appear in the partitions)
2318+
*/
2319+
if (tableinfo.hastriggers ||
2320+
tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
23162321
{
23172322
printfPQExpBuffer(&buf,
23182323
"SELECT conname,\n"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy