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

From: Benjie Gillam <benjie(at)jemjie(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Sort policies and triggers by table name in pg_dump.
Date: 2019-09-24 07:48:33
Message-ID: CAMThMzFTakHM90GphqaAmWXacrAYZFoZvGgL0W=9siZL-Ge3ug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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.

Attachment Content-Type Size
pg-dump-policy-trigger-sort_v2.patch text/x-patch 1.3 KB
reproduce.sh application/x-shellscript 1.1 KB
reproduce.diff text/x-patch 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2019-09-24 08:35:47 Re: Index Skip Scan
Previous Message Julien Rouhaud 2019-09-24 07:20:02 Re: Hypothetical indexes using BRIN broken since pg10