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 1l9UCP-0005Rp-7a for pgsql-general@arkaria.postgresql.org; Tue, 09 Feb 2021 14:41:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l9UCN-0003Ok-Qc for pgsql-general@arkaria.postgresql.org; Tue, 09 Feb 2021 14:41:03 +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 1l9UCN-0003Od-GV for pgsql-general@lists.postgresql.org; Tue, 09 Feb 2021 14:41:03 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9UCL-0008GL-HX for pgsql-general@postgresql.org; Tue, 09 Feb 2021 14:41:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Reply-To: Message-ID:Subject:To:Sender:From:Date:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tlg5UPZerErt90PD2ov0u5xFR1EedIwOWsxGSqpo0oc=; b=FbcZmU0QvJIluD2MFA1Ev+3LlD gRSz4XLyY9hcaPU0U2LPfeeIWXzHI/zeEOjJ4YcVJ+u4oKmddZC2DWOXm3TB0dtWCaJGE46r+WoKd GQjip1P+py7vo9/EgGau+eL2KWoGb+W5ZnV8npmCLYThfSjecpF3Go3udu8qXWCXgrLY=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1l9UCJ-0007pI-T2 for pgsql-general@postgresql.org; Tue, 09 Feb 2021 15:40:59 +0100 Date: Tue, 9 Feb 2021 15:40:59 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: pgsql-general mailing list Subject: How to I select value of GUC that has - in its name? Message-ID: <20210209144059.GA21360@depesz.com> Reply-To: depesz@depesz.com MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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? depesz