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 1ncU0I-0006CU-HN for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Apr 2022 15:24:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ncU0H-0005GX-FT for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Apr 2022 15:24:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ncU0G-0004js-UP for pgsql-hackers@lists.postgresql.org; Thu, 07 Apr 2022 15:24:57 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ncU0C-0008CW-0h for pgsql-hackers@lists.postgresql.org; Thu, 07 Apr 2022 15:24:55 +0000 Received: by mail-io1-xd29.google.com with SMTP id q11so7164511iod.6 for ; Thu, 07 Apr 2022 08:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sMxjitivx7xuotLkoaueROGphkTXuzgBBxrVfs3Orm4=; b=ermIOgGoHG9PofPtFLR02xaTGhPdtv6i+doK242FXBVsUAqDVQYxAcU0NPdRFFhFMk V6fhc0FkTBJ+qagoiW73JAmJtGgf6YPHTJrNHuhYmoD6vz12g6wIsHyptAaSdwKj8hqy UeycBrUbSV/EKaURUReTcP5UiJj33gxP0jEJ6bmHGMVoTYuNPgV9/6ezFO9U1a7EgPnF 58l3J9X14BRUHnZyOD4Qe1n6ofGAhEdq2v/Go9wyidTD17ypw1yvUxA0rCaFtwM9rsg5 6WLt8QCR2eEjeasDJDr1YmnBIK/M/u2zL7vyqC5SVY/EmUS9d4SOMisZC6qnpVURMQyG 2jNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sMxjitivx7xuotLkoaueROGphkTXuzgBBxrVfs3Orm4=; b=zRZU663bqmyt6ccMnr4m4nEhLazJnQFZy7jK6akIYV6zPmTqNGthhFTwiI5LpTXAzv pBjpWG2Qfl5lFV54pTFb1bG/P/R86a3le3VF+XNz/ioCho8pHE+D0rSGGnTRX4uFUxJZ Tx2L/C5uK0lb/nNFW/4e8d951WFj8PlWsR/vwzTHOaeJzgC0rvpe9DvcZ00K0KvTWrFp i6GP5C+yQBEUqqtiMuWPD9uL5+aSyd51t6YfPzTZXLiTQxmMXRmh4bkXiJFzrxzYMI8j eZhUgHvlhSaeIWm0JiuM3lJJsWHvYrPJGjjYbMNrX73cNTGI1IYdpIEDDSa1PYEcJ7Zd j+MA== X-Gm-Message-State: AOAM530V43HzD8+0GUDgNX74TImavlFnAN6u3CJ8QmSkZd6juBjZnk+W DwPofDto8UGPwRb7kdO78WbZZQ== X-Google-Smtp-Source: ABdhPJx90Ew02MP0psCkm1atYLpCTgaTnmnARZvge1vk7aQMycRU9FA1iEW1/rvQBiTsdc+5QPm4Tw== X-Received: by 2002:a02:c995:0:b0:324:2e15:bb7c with SMTP id b21-20020a02c995000000b003242e15bb7cmr645995jap.21.1649345091101; Thu, 07 Apr 2022 08:24:51 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id a3-20020a92d583000000b002c9fb55e727sm11538044iln.41.2022.04.07.08.24.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Apr 2022 08:24:50 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id E1874800E68; Thu, 7 Apr 2022 10:24:49 -0500 (CDT) Date: Thu, 7 Apr 2022 10:24:49 -0500 From: Justin Pryzby To: Tom Lane Cc: "Jonathan S. Katz" , "David G. Johnston" , Joe Conway , Alvaro Herrera , pgsql-hackers@lists.postgresql.org, Pavel Luzanov , Greg Stark , Mark Dilger Subject: Re: How about a psql backslash command to show GUCs? Message-ID: <20220407152449.GD24419@telsasoft.com> References: <202204061758.leffczewl4kd@alvherre.pgsql> <3123259.1649270440@sss.pgh.pa.us> <38891fd8-dceb-c956-ec5c-61c1a3e9486d@postgresql.org> <3201870.1649294165@sss.pgh.pa.us> <6693b128-b9e5-fd5e-e8d2-b331dac52cb8@postgresql.org> <3221981.1649300574@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3221981.1649300574@sss.pgh.pa.us> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 06, 2022 at 11:02:54PM -0400, Tom Lane wrote: > "Jonathan S. Katz" writes: > > +1 for \dconf > > Here's a draft patch using \dconf. No tests or docs yet. The patch as written is a thin layer around pg_settings. SHOW and current_setting() translate to human units, which is particularly useful for some settings, like those with units of 8k pages. Is it better to use that "cooked" version for display in the backslash command instead of the raw view from pg_settings ? Otherwise, I see myself first using tab completion or, failing that, SELECT * FROM pg_settings WHERE name~'something', followed by SHOW, to avoid messing up counting digits, multiplication or unit conversions. > + printfPQExpBuffer(&buf, > + "SELECT s.name AS \"%s\", s.setting AS \"%s\", " > + "s.unit AS \"%s\", s.vartype AS \"%s\"", > + gettext_noop("Parameter"), > + gettext_noop("Setting"), > + gettext_noop("Unit"), > + gettext_noop("Type")); > + > + appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_settings s\n");