[PATCH] Sort policies and triggers by table name in pg_dump.

From: Benjie Gillam <benjie(at)jemjie(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Sort policies and triggers by table name in pg_dump.
Date: 2019-09-23 21:34:07
Message-ID: CAMThMzEEt2mvBbPgCaZ1Ap1N-moGn=Edxmadddjq89WG4NpPtQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
pg-dump-policy-trigger-sort_v1.patch text/x-patch 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2019-09-23 21:35:07 Re: Efficient output for integer types
Previous Message David Fetter 2019-09-23 20:25:54 Re: Efficient output for integer types