On 2018/05/14 11:50, Amit Langote wrote:
> Hi.
> 
> I just noticed $subject, which attached seems to fix, although not sure if
> that's the correct fix for the issue.

I updated the comment above the changed code to explain things as I see them.

Attached updated patch.

Thanks,
Amit
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 410131e5c7..e72fdc5f72 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, any needed
+                * triggers are present in the table's partitions)
+                */
+               if (tableinfo.hastriggers ||
+                       tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
                {
                        printfPQExpBuffer(&buf,
                                                          "SELECT conname,\n"

Reply via email to