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 1n4wdd-0007sJ-9I for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jan 2022 03:06:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n4wdb-00036E-Qs for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jan 2022 03:06:55 +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 1n4wdb-00035y-E9 for pgsql-hackers@lists.postgresql.org; Wed, 05 Jan 2022 03:06:55 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n4wdX-00048c-OE for pgsql-hackers@lists.postgresql.org; Wed, 05 Jan 2022 03:06:54 +0000 Received: by mail-il1-x12a.google.com with SMTP id x15so29896465ilc.5 for ; Tue, 04 Jan 2022 19:06:51 -0800 (PST) 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=KJaY2bYW5vppIwvbyGZCPOt6LxpcTldCVMOB4v3LPIA=; b=U6dVkCBoInWmU2FC0RFGm1y7+TLFybFgw9E60Yo/MYMEwz0r4fw3J7NHwKDJnkpQOG qhdZ9u63PQDz/vTZOX1jY15ovL6F42wWOroqPQPHU8lu3wQP+Db4app/JYU9E8psHlRc hX10nMsVN7ZS2o1iN7pkUPrDdPQGXNg4j5ElGQoehVqbbTQBfuhhzX3+F+wGyJfbB5Qg /MMMxbEV1jwK3aPXqNLfu0xXFWg5lO5jGzQW7cnJ1w6f+mPXfst30UR80AcOAN0wx7Ij XVXs+JFNsP0eKLQbhcvkB0fuzWu+b/WJhp5SeG7LocUjjLPg8TLk8RrU8b1fc8cuUM/j AdMA== 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=KJaY2bYW5vppIwvbyGZCPOt6LxpcTldCVMOB4v3LPIA=; b=ClROgGvnPMBt4CeCGu5Xt/Z8VF2cZvMhlDE9xNWlORwO9EHrHIQ/etSz4SdbuyVUq2 cVx5P94pqxk0H/GqeVdhqaN4iMDuBdYotbqeeCZLeAD9kYdDFqADlAufuqWwCXm3TtUw 5ZAL4S0teINhXj7vaImm7aMOHgpkPOSwNvdOW3RRpLG8AK0G2cATIXBbVT0E7/OETtDE dKi1nV3+jry2UOCCy5dDRfCCw97anhFEbzbiwWRAUzHcxVKRr1ukUBix7YPdlGNZITwF TwVhTfpXRCXIg8tvCSmLWcphXsaaU9fuWi30Df6Wi80y3Ra+p0+bJwPzWBi5SGzVIY1v 7uWg== X-Gm-Message-State: AOAM530O0Z84asBg+zdcugid6tkmIzDqob66phuQOKw4zwfs9ZH2r05f SHarIQhhyAoChy6nj+qRvugAMA== X-Google-Smtp-Source: ABdhPJxMGweC2ZPvhqJ7cWZ6lsh0/Te9qjxJrPZX0C0k6KqtUAnlodkeaCsWY5zysHOLTj7F/kNFDg== X-Received: by 2002:a05:6e02:1a8a:: with SMTP id k10mr20563430ilv.127.1641352010580; Tue, 04 Jan 2022 19:06:50 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id i20sm27574513iow.9.2022.01.04.19.06.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jan 2022 19:06:50 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 11E2180160F; Tue, 4 Jan 2022 21:06:48 -0600 (CST) Date: Tue, 4 Jan 2022 21:06:48 -0600 From: Justin Pryzby To: Kyotaro Horiguchi Cc: michael@paquier.xyz, peter.eisentraut@enterprisedb.com, pgsql-hackers@lists.postgresql.org, bruce@momjian.us, tgl@sss.pgh.pa.us Subject: Re: GUC flags Message-ID: <20220105030648.GE14051@telsasoft.com> References: <20211209155322.GG17618@telsasoft.com> <20211229023240.GM24477@telsasoft.com> <20220105.114757.369416916044334409.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220105.114757.369416916044334409.horikyota.ntt@gmail.com> 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, Jan 05, 2022 at 11:47:57AM +0900, Kyotaro Horiguchi wrote: > At Tue, 28 Dec 2021 20:32:40 -0600, Justin Pryzby wrote in > > On Thu, Dec 09, 2021 at 09:53:23AM -0600, Justin Pryzby wrote: > > > On Thu, Dec 09, 2021 at 05:17:54PM +0900, Michael Paquier wrote: > > > One option is to expose the GUC flags in pg_settings, so this can all be done > > > in SQL regression tests. > > > > > > Maybe the flags should be text strings, so it's a nicer user-facing interface. > > > But then the field would be pretty wide, even though we're only adding it for > > > regression tests. The only other alternative I can think of is to make a > > > sql-callable function like pg_get_guc_flags(text guc). > > > > Rebased on cab5b9ab2c066ba904f13de2681872dcda31e207. > > > > And added 0003, which changes to instead exposes the flags as a function, to > > avoid changing pg_settings and exposing internally-defined integer flags in > > that somewhat prominent view. > > Just an idea but couldn't we use flags in a series of one-letter flag > representations? It is more user-friendly than integers but shorter > than full-text representation. > > +SELECT name, flags FROM pg_settings; > name | flags > ------------------------+-------- > application_name | ARsec > transaction_deferrable | Arsec > transaction_isolation | Arsec > transaction_read_only | Arsec It's a good idea. I suppose you intend that "A" means it's enabled and "a" means it's disabled ? A => show all R => reset all S => not in sample E => explain C => computed Which is enough to support the tests that I came up with: + (flags&4) != 0 AS no_show_all, + (flags&8) != 0 AS no_reset_all, + (flags&32) != 0 AS not_in_sample, + (flags&1048576) != 0 AS guc_explain, + (flags&2097152) != 0 AS guc_computed However, I think if we add a field to pg_stat_activity, it would be in a separate patch, expected to be independently useful. 1) expose GUC flags to pg_stat_activity; 2) rewrite check_guc as a sql regression test; In that case, *all* the flags should be exposed. There's currently 20, which means it may not work well after all - it's already too long, and could get longer, and/or overflow the alphabet... I think pg_get_guc_flags() may be best, but I'm interested to hear other opinions. -- Justin