pgsql: Make pg_dump's table of object-type priorities more maintainable

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make pg_dump's table of object-type priorities more maintainable
Date: 2021-01-12 02:09:38
Message-ID: E1kz97q-0000fZ-Np@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make pg_dump's table of object-type priorities more maintainable.

Wedging a new object type into this table has historically required
manually renumbering a lot of existing entries. (Although it appears
that some people got lazy and re-used the priority level of an
existing object type, even if it wasn't particularly related.)
We can let the compiler do the counting by inventing an enum type that
lists the desired priority levels in order. Now, if you want to add
or remove a priority level, that's a one-liner.

This patch is not purely cosmetic, because I split apart the priorities
of DO_COLLATION and DO_TRANSFORM, as well as those of DO_ACCESS_METHOD
and DO_OPERATOR, which look to me to have been merged out of expediency
rather than because it was a good idea. Shell types continue to be
sorted interchangeably with full types, and opclasses interchangeably
with opfamilies.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d5ab79d815783fe60062cefc423b54e82fbb92ff

Modified Files
--------------
src/bin/pg_dump/pg_dump_sort.c | 137 ++++++++++++++++++++++++++++-------------
1 file changed, 93 insertions(+), 44 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2021-01-12 02:26:02 pgsql: Optimize DropRelFileNodeBuffers() for recovery.
Previous Message Thomas Munro 2021-01-11 22:06:30 pgsql: Fix function prototypes in dependency.h.