Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWUE6-0008D7-I6 for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Jan 2018 21:36:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWUE5-0000SW-H9 for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Jan 2018 21:36:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eWUE5-0000SM-4O for pgsql-bugs@lists.postgresql.org; Tue, 02 Jan 2018 21:36:01 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eWUE1-00030b-0L for pgsql-bugs@postgresql.org; Tue, 02 Jan 2018 21:36:00 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8B55E20A54; Tue, 2 Jan 2018 16:35:54 -0500 (EST) Received: from web1 ([10.202.2.211]) by compute6.internal (MEProxy); Tue, 02 Jan 2018 16:35:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Zfy6zV2Rq2LkhZy1ld27E+5JJw+Js sadXqN1cNtG+w4=; b=C/SSW45KOriMQoMY2rk4kpSO7qbfjMQhDbSjO6FeBn9oO Zuo2aAt6nRYeU8k5UO051vu60c01nyDAqYy0oGHt0BFUK/T2evQzQ9IPyc07EPfO 1v+5NSO35uzSnWHvIQA/58uaX88S1+/rCqjuhvf/qiT+3fodlbY2bVf3oAslzZ07 2xLS4hKastqvOZsxl3YMp7OJ6gYRk/28Y8vrP5wnKqR286zLUGqoCMPKc4mcCg7h 5oGMUJDaiScAJi+3V+QOKtPcpaZ65Ef/tzU4btzs//F18HprlvvpTovO7pCrJQTU npFJgREb7M/jci/kkyoeFMeRVUJ/unNwjtxilc2ew== X-ME-Sender: Received: by mailuser.nyi.internal (Postfix, from userid 99) id 6CD4094205; Tue, 2 Jan 2018 16:35:54 -0500 (EST) Message-Id: <1514928954.4186795.1222195928.436BC5FE@webmail.messagingengine.com> From: Alan Robertson To: David Fetter Cc: "David G. Johnston" , Amit Kapila , Tom Lane , Postgres Bug MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-cc9a457c Subject: Re: ALTER SYSTEM for tcp_keepalives_idle doesn't show up with the SHOW command. Date: Tue, 02 Jan 2018 14:35:54 -0700 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Tue, Jan 02, 2018 at 03:55:14PM +0000, Robertson, Alan L wrote: >> >> This query seems to be pretty cool for looking at configuration changes: >> >> SELECT pg_settings.setting INTO TEMPORARY config_file FROM pg_settings WHERE name = 'config_file'; >> SELECT * FROM config_file INNER JOIN pg_file_settings ON config_file.setting!=pg_file_settings.sourcefile; >> >> The intent of this query is to return the values of all settings which have been modified by SQL from the installation defaults. >> >> I'm an SQL newbie, so I'm sure this august body can improve it. But it does appear to work ;-) > It does indeed. >> The output of the join looks something like this - and it has the _correct_ version of the TCP variables, even when run locally. >> >> >> setting | sourcefile | sourceline | seqno | name | setting | applied | error >> ------------------------------------------+---------------------------------------------------+------------+-------+---------------------+---------+---------+------- >> /etc/postgresql/9.5/main/postgresql.conf | /var/lib/postgresql/9.5/main/postgresql.auto.conf | 3 | 23 | tcp_keepalives_idle | 60 | t | >> (1 row) > > You don't actually need to create a temporary table to get that. You > could use something like: > > SELECT > s.setting, f.* > FROM > pg_settings s > JOIN > pg_file_settings f > ON ( > s.name = 'config_file' AND > s.setting <> f.sourcefile > ); I've written a piece of Python which creates the necessary ALTER SYSTEM commands to back up the system changes made by previous ALTER SYSTEM commands. It needed the query above to get a little more complicated - to get the type of the configuration parameter. It now looks like this: SELECT f.seqno, f.name, s2.vartype, f.setting, f.applied, f.error, s2.pending_restart FROM pg_settings AS s JOIN pg_file_settings AS f ON ( s.name = 'config_file' AND s.setting <> f.sourcefile ) JOIN pg_settings AS s2 ON ( s2.name = f.name) ORDER BY f.seqno; Thanks again for everyone's help and consideration! Like I said, I've learned a lot. -- Alan