Re: [PATCH] Sort policies and triggers by table name in pg_dump.
Benjie Gillam <benjie@jemjie.com>
From: Benjie Gillam <benjie@jemjie.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@postgresql.org
Date: 2019-09-24T07:48:33Z
Lists: pgsql-hackers
Attachments
- pg-dump-policy-trigger-sort_v2.patch (text/x-patch) patch v2
- reproduce.sh (application/x-shellscript)
- reproduce.diff (text/x-patch) patch
> Could you provide a simple example of schema (tables with some
> policies and triggers), with the difference this generates for
> pg_dump, which shows your point?
Certainly; I've attached a bash script that can reproduce the issue
and the diff that it produces, here's the important part:
CREATE TRIGGER a BEFORE INSERT ON foo
FOR EACH ROW EXECUTE PROCEDURE qux();
CREATE POLICY a ON foo FOR SELECT USING (true);
CREATE TRIGGER a BEFORE INSERT ON bar
FOR EACH ROW EXECUTE PROCEDURE qux();
CREATE POLICY a ON bar FOR SELECT USING (true);
Here we create two identically named triggers and two identically
named policies on tables foo and bar. If instead we ran these
statements in a different order (or if the object IDs were to wrap)
the order of the pg_dump would be different even though the
databases are identical other than object IDs. The attached
patch eliminates this difference.
> Your patch has two warnings because you are trying to map a policy
> info pointer to a trigger info pointer:
Ah, thank you for the pointer (aha); I've attached an updated patch
that addresses this copy/paste issue.
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