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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Benjie Gillam <benjie(at)jemjie(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Sort policies and triggers by table name in pg_dump.
Date: 2019-09-24 02:02:13
Message-ID: 20190924020213.GC2012@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-09-24 02:07:16 Re: Add "password_protocol" connection parameter to libpq
Previous Message Amit Langote 2019-09-24 01:52:30 Fix example in partitioning documentation