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

From Michael Paquier
Subject Re: [PATCH] Sort policies and triggers by table name in pg_dump.
Date
Msg-id 20190924020213.GC2012@paquier.xyz
Whole thread Raw
In response to [PATCH] Sort policies and triggers by table name in pg_dump.  (Benjie Gillam <benjie@jemjie.com>)
Responses Re: [PATCH] Sort policies and triggers by table name in pg_dump.
List pgsql-hackers
On Mon, Sep 23, 2019 at 10:34:07PM +0100, Benjie Gillam wrote:
> The attached draft patch (made against `pg_dump_sort.c` on master) breaks
> ties for trigger and policy objects by using the table name, increasing the
> sort order stability. I have compiled it and executed it against a number of
> local databases and it behaves as desired.

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?

> I am new to PostgreSQL contribution and my C-skills are rusty, so please let
> me know if I can improve the patch, or if there are areas of PostgreSQL that
> I have overlooked.

Your patch has two warnings because you are trying to map a policy
info pointer to a trigger info pointer:
pg_dump_sort.c:224:24: warning: initialization of ‘TriggerInfo *’ {aka
‘struct _triggerInfo *’} from incompatible pointer type ‘PolicyInfo *
const’ {aka ‘struct _policyInfo * const’}
[-Wincompatible-pointer-types]
  224 |   TriggerInfo *tobj2 = *(PolicyInfo *const *) p2;
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Fix example in partitioning documentation
Next
From: Michael Paquier
Date:
Subject: Re: Add "password_protocol" connection parameter to libpq