[PATCH] Sort policies and triggers by table name in pg_dump.
Benjie Gillam <benjie@jemjie.com>
From: Benjie Gillam <benjie@jemjie.com>
To: pgsql-hackers@postgresql.org
Date: 2019-09-23T21:34:07Z
Lists: pgsql-hackers
Attachments
- pg-dump-policy-trigger-sort_v1.patch (text/x-patch) patch v1
Hello all, Currently pg_dump sorts most dumpable objects by priority, namespace, name and then object ID. Since triggers and RLS policies belong to tables, there may be more than one with the same name within the same namespace, leading to potential sorting discrepancies between databases that only differ by object IDs. The attached draft patch (made against `pg_dump_sort.c` on master) breaks ties for trigger and policy objects by using the table name, increasing the sort order stability. I have compiled it and executed it against a number of local databases and it behaves as desired. I am new to PostgreSQL contribution and my C-skills are rusty, so please let me know if I can improve the patch, or if there are areas of PostgreSQL that I have overlooked. Kind regards, Benjie Gillam
Commits
-
Stabilize pg_dump output order for similarly-named triggers and policies.
- ee8b95f2684a 10.11 landed
- da5cd7a68a33 9.4.25 landed
- ca27a84c98f0 12.1 landed
- 74d32ee704eb 9.5.20 landed
- 648f17879e61 9.6.16 landed
- 5102f39440f7 13.0 landed
- 078f5bc8e307 11.6 landed