Re: [PATCH] Sort policies and triggers by table name in pg_dump. - Mailing list pgsql-hackers

From Benjie Gillam
Subject Re: [PATCH] Sort policies and triggers by table name in pg_dump.
Date
Msg-id CAMThMzFTakHM90GphqaAmWXacrAYZFoZvGgL0W=9siZL-Ge3ug@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Sort policies and triggers by table name in pg_dump.  (Michael Paquier <michael@paquier.xyz>)
Responses Re: [PATCH] Sort policies and triggers by table name in pg_dump.
Re: [PATCH] Sort policies and triggers by table name in pg_dump.
List 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

pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Hypothetical indexes using BRIN broken since pg10
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Index Skip Scan