Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfU6A-0008Ky-0n for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jun 2019 18:53:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hfU68-0000nP-SR for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jun 2019 18:53:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfU68-0000nH-GB for pgsql-hackers@lists.postgresql.org; Mon, 24 Jun 2019 18:53:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfU66-0004Vs-6u for pgsql-hackers@postgresql.org; Mon, 24 Jun 2019 18:53:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x5OIrgiv014329; Mon, 24 Jun 2019 14:53:42 -0400 From: Tom Lane To: Robert Haas cc: Stephen Frost , Ian Barwick , Amit Kapila , "pgsql-hackers@postgresql.org" Subject: Re: [PATCH] Stop ALTER SYSTEM from making bad assumptions In-reply-to: References: <20190614160835.GF2480@tamriel.snowman.net> <20190616171610.GO2480@tamriel.snowman.net> <27dc9f8d-8d8f-9dd1-0494-5d8bd2f49a45@2ndquadrant.com> <20372.1561134638@sss.pgh.pa.us> <20190621164028.GO2480@tamriel.snowman.net> <21353.1561136112@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 24 Jun 2019 13:25:22 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14327.1561402422.1@sss.pgh.pa.us> Date: Mon, 24 Jun 2019 14:53:42 -0400 Message-ID: <14328.1561402422@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Fri, Jun 21, 2019 at 12:55 PM Tom Lane wrote: >> Ah, got it. So it seems like the correct behavior might be for >> ALTER SYSTEM to >> (a) run through the whole file and remove any conflicting lines; >> (b) append new setting at the end. > That is exactly the behavior for which I am arguing. Stephen also > wants a warning, but I disagree, because the warning is totally > non-actionable. It tells you that some tool, at some point in the > past, did something bad. You can't do anything about that, and you > wouldn't need to except for the arbitrary decision to label duplicate > lines as bad in the first place. Agreed; there's no particular reason to consider the situation as wrong. guc.c has always had the policy that dups are fine and the last one wins. The very design of ALTER SYSTEM owes its workability to that policy, so we can hardly say that A.S. should have a different policy internally. The problem here is simply that ALTER SYSTEM is failing to consider the possibility that there are dups in postgresql.auto.conf, and that seems like little more than an oversight to be fixed. There's more than one way we could implement a fix, perhaps, but I don't really see a reason to work harder than is sketched above. (BTW, has anyone checked whether ALTER SYSTEM RESET is prepared to remove multiple lines for the same var?) regards, tom lane