Always have pg_dump write rules in a consistent order

Started by Andreas Karlssonover 1 year ago3 messageshackers
Jump to latest
#1Andreas Karlsson
andreas.karlsson@percona.com

Hi,

When working on a new feature for PostgreSQL I noticed that the
pg_upgrade tests became flaky due to rules being dumped in a different
order between the original cluster and the upgraded cluster. (For
context: my regress scripts left a bunch of views with dependency
circles which I had forgot to clean up.)

So I propose that we sort rules on (schema, name, relation_name) instead
of (schema, name, oid) like it currently does. The patch itself is small
enough and makes it easier to test that we upgrade rules and views
correctly with pg_upgrade.

Andreas

Attachments:

0001-Make-pg_dump-always-write-rules-in-a-stable-order.patchtext/x-patch; charset=UTF-8; name=0001-Make-pg_dump-always-write-rules-in-a-stable-order.patchDownload+11-1
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andreas Karlsson (#1)
Re: Always have pg_dump write rules in a consistent order

Andreas Karlsson <andreas@proxel.se> writes:

When working on a new feature for PostgreSQL I noticed that the
pg_upgrade tests became flaky due to rules being dumped in a different
order between the original cluster and the upgraded cluster. (For
context: my regress scripts left a bunch of views with dependency
circles which I had forgot to clean up.)

So I propose that we sort rules on (schema, name, relation_name) instead
of (schema, name, oid) like it currently does. The patch itself is small
enough and makes it easier to test that we upgrade rules and views
correctly with pg_upgrade.

Seems reasonable. Pushed with some trivial cosmetic adjustments
to make it look more like the identical adjacent cases for policies
and triggers.

regards, tom lane

#3Andreas Karlsson
andreas.karlsson@percona.com
In reply to: Tom Lane (#2)
Re: Always have pg_dump write rules in a consistent order

On 11/4/24 7:32 PM, Tom Lane wrote:

Seems reasonable. Pushed with some trivial cosmetic adjustments
to make it look more like the identical adjacent cases for policies
and triggers.

Thanks!

Andreas