Re: [PATCH] Stop ALTER SYSTEM from making bad assumptions

From: Ian Barwick <ian(dot)barwick(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Stop ALTER SYSTEM from making bad assumptions
Date: 2019-08-02 22:39:27
Message-ID: c87c6599-8f60-754f-620d-c30faa0dceea@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/3/19 7:27 AM, Tom Lane wrote:
> Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> writes:
>> There seems to be a consensus that this this not a pg_basebackup issue
>> (i.e. duplicate values don't make the file invalid), and it should be
>> handled in ALTER SYSTEM.
>
> Yeah. I doubt pg_basebackup is the only actor that can create such
> situations.
>
>> The proposal seems to be to run through the .auto.conf file, remove any
>> duplicates, and append the new entry at the end. That seems reasonable.
>
> +1
>
>> There was a discussion whether to print warnings about the duplicates. I
>> personally see not much point in doing that - if we consider duplicates
>> to be expected, and if ALTER SYSTEM has the license to rework the config
>> file any way it wants, why warn about it?
>
> Personally I agree that warnings are unnecessary.

Having played around with the pg.auto.conf stuff for a while, my feeling is
that ALTER SYSTEM does indeed have a license to rewrite it (which is what
currently happens anyway, with comments and include directives [1] being silently
removed) so it seems reasonable to remove duplicate entries and ensure
the correct one is processed.

[1] suprisingly any include directives present are honoured, which seems crazy
to me, see: https://www.postgresql.org/message-id/flat/8c8bcbca-3bd9-dc6e-8986-04a5abdef142%402ndquadrant.com

>> The main issue however is that no code was written yet.
>
> Seems like it ought to be relatively simple ... but I didn't look.

The patch I originally sent does exactly this.

The thread then drifted off into a discussion about providing ways for
applications to properly write to pg.auto.conf while PostgreSQL is not
running; I have a patch for that which I can submit later (though it
is a thing of considerable ugliness).

Regards

Ian Barwick

--
Ian Barwick https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-08-02 22:39:50 Re: jsonb_plperl bug
Previous Message Stephen Frost 2019-08-02 22:38:46 Re: [PATCH] Stop ALTER SYSTEM from making bad assumptions