Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9V8k-00021j-BR for pgsql-general@arkaria.postgresql.org; Tue, 09 Feb 2021 15:41:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l9V8j-0003Jb-7P for pgsql-general@arkaria.postgresql.org; Tue, 09 Feb 2021 15:41:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9V8i-0003JU-6z for pgsql-general@lists.postgresql.org; Tue, 09 Feb 2021 15:41:21 +0000 Received: from [64.147.123.21] (helo=wout5-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9V8f-0000Lm-2h for pgsql-general@postgresql.org; Tue, 09 Feb 2021 15:41:19 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id B775DB76; Tue, 9 Feb 2021 10:41:04 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 09 Feb 2021 10:41:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=N 66nH1WCdT9UNft3NROM7iDjc011zL8J3B0Xr17+B98=; b=QVaOqB4joVGY7rk4N FIfcN0ID+YrWStcqKwh5ykPj6RqYEWjwMmJur1qMn8vGIhg9pist8tvtwT3AYk+a 5FOZ1WlPrfnX+LGaVjM4UP5x+GfqXfphbH2ZBbTNDkAamu2H3mJCllU+tAdlDJLa 6xrjJtglaA8aCc+ey9OUcC2BhurdqMGPgpEm4xfsPuGKiF4hgyV3qN3HGOo8UW07 WKWgmS4trNmpu/Elogbxd3WLLlaXsDgNf8S07ij6w8aTDsXPE2vaSEIyrmj4Z+iH OQTG4tNKQEZVVcHQgvgIdc8+YLqu64ijqx7hCdMsd30DTNJDqV5bHPgUEBGTIQ3a WSi1w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=N66nH1WCdT9UNft3NROM7iDjc011zL8J3B0Xr17+B 98=; b=nN0wxo++x9yFsVWwhQlqHAehBhsQZZR5TqWeL3zMRSiubaMbVqIPNyHxK mNhJtKe1m2KzxktZLAEVqQVpbFN6bBHrU9I3hAG51xVq5zdzuoZsxs6+vqw9kAU3 wozatm9fCqHdX6qu1A1RvgUp2k5wAk/s2dgeszrE9xOfqTptCVLTXlDTTQX/Urwm HzkNgggSqvQk2CY3BhtvPaproThgJ1PsvNUZ8mBoslxlOmvNwCfQw3d6xXkSNxd0 qcbFPvH3uww69n6ROibg1CtFxBISMEcp1VKt5/k4T3W/MKkByuFpVClx+qL1IUWu bQ8nCoRM1iPDZsypmRi7wz2biITuA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrheehgdekudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepveevfeevfeeugeffkeekhfegieeufffgteeujedvgffh ueejjefhkeejleegtdegnecukfhppeeljedruddufedrvddujedrvdejnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.4] (97-113-217-27.tukw.qwest.net [97.113.217.27]) by mail.messagingengine.com (Postfix) with ESMTPA id 94EB124005B; Tue, 9 Feb 2021 10:41:03 -0500 (EST) Subject: Re: How to I select value of GUC that has - in its name? To: depesz@depesz.com, pgsql-general mailing list References: <20210209144059.GA21360@depesz.com> From: Adrian Klaver Message-ID: Date: Tue, 9 Feb 2021 07:41:02 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210209144059.GA21360@depesz.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.21 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/9/21 6:40 AM, hubert depesz lubaczewski wrote: > Hi, > question from IRC, but I couldn't find an answer. > > I can set custom guc with - in name, but I can't figure out how to > select it. > > Without minus, it works great: > > =$ psql -X -c 'show custom.guc' > ERROR: unrecognized configuration parameter "custom.guc" > > =$ psql -X -c "alter user depesz set custom.guc = '123'" > ALTER ROLE > > =$ psql -X -c 'show custom.guc' > custom.guc > ------------ > 123 > (1 row) > > If I'd try to set variable with - in name: > > $ alter user depesz set custom.bad-guc = '1a'; > ERROR: syntax error at or near "-" > LINE 1: alter user depesz set custom.bad-guc = '1a'; > ^ > $ alter user depesz set custom."bad-guc" = '1a'; > ALTER ROLE > > $ select * from pg_db_role_setting where setrole = 'depesz'::regrole; > setdatabase │ setrole │ setconfig > ─────────────┼─────────┼───────────────────────────────────────────────────────── > 0 │ 16384 │ {application_name=xxx,custom.guc=123,custom.bad-guc=1a} > (1 row) > > OK. Looks like it's set. But I can't show it (this is after reconnect): > > $ show custom."bad-guc"; > ERROR: unrecognized configuration parameter "custom.bad-guc" > > $ show "custom"."bad-guc"; > ERROR: unrecognized configuration parameter "custom.bad-guc" > > $ show "custom.bad-guc"; > ERROR: unrecognized configuration parameter "custom.bad-guc" > > I know I can simply not use dashes in names, but if I can *set* it, how > can I get the value back? The only way I found so far is: select setconfig[array_position(setconfig, 'custom.bad-guc=1a')] from pg_db_role_setting where setrole = 'aklaver'::regrole; setconfig ------------------- custom.bad-guc=1a > > depesz > > -- Adrian Klaver adrian.klaver@aklaver.com