]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pg_dump: provide a stable sort order for rules.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 4 Nov 2024 18:30:30 +0000 (13:30 -0500)
committerNoah Misch <noah@leadboat.com>
Thu, 31 Jul 2025 13:38:00 +0000 (06:38 -0700)
commit5dd4957b28df92d25508e4d0c950099c52347a75
tree3583c3097af0718c7c4617a62933c2b56f4be010
parent8de56323c1396626a9d667a0dfe6e1c3a8ca1637
pg_dump: provide a stable sort order for rules.

Previously, we sorted rules by schema name and then rule name;
if that wasn't unique, we sorted by rule OID.  This can be
problematic for comparing dumps from databases with different
histories, especially since certain rule names like "_RETURN"
are very common.  Let's make the sort key schema name, rule name,
table name, which should be unique.  (This is the same behavior
we've long used for triggers and RLS policies.)

Andreas Karlsson

This back-patches v18 commit 350e6b8ea86c22c0b95c2e32a4e8d109255b5596 to
all supported branches.  The next commit will assert that pg_dump
provides a stable sort order for all object types.  That assertion would
fail without stabilizing DO_RULE order as this commit did.

Discussion: https://postgr.es/m/b4e468d8-0cd6-42e6-ac8a-1d6afa6e0cf1@proxel.se
Discussion: https://postgr.es/m/20250707192654.9e.nmisch@google.com
Backpatch-through: 13-17
src/bin/pg_dump/pg_dump_sort.c