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 1n5LSC-0007O4-Ud for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Jan 2022 05:36:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n5LSB-0000yd-Pu for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Jan 2022 05:36:47 +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 1n5LSB-0000yU-Gu for pgsql-hackers@lists.postgresql.org; Thu, 06 Jan 2022 05:36:47 +0000 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n5LS9-00008w-Ce for pgsql-hackers@lists.postgresql.org; Thu, 06 Jan 2022 05:36:47 +0000 Received: by mail-il1-x12e.google.com with SMTP id x15so1274924ilc.5 for ; Wed, 05 Jan 2022 21:36:44 -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=RbEoDPW7TBT9Of9cLbVa7IwFZG8Q1gxeEiCj2elVDBE=; b=cah1SUcZTJ9+um/rVQszYOfkjyGncGuzDwpwevX9KDiX5K61OJUoiVX1yyjKQTL9sY fyaytM+JYV5VPI086SvspBmZ47Dq8kHQTayMzzxdVoxatH5dVfdIpWUUmUKjxj5pHNFc 20dlR3CTpG1/Ra8TujLejUSKxbo3cr+h6mfGI2KzhNchAFyvtEVTuyUkrmxhrwLlXk4R 1fYwX5sbPM1bUMiYbchrWIioCnQwvO1XQMN+c8WnK/CsnZeMkpZIpiJI0/4b6CakwyL/ ovSyzLY9PqulveG6Cb3Bnnun8cKtISBTeeEUbVjwO+8vEFsgN4DGzPJVQU+Z2BXZdmqH o49A== 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=RbEoDPW7TBT9Of9cLbVa7IwFZG8Q1gxeEiCj2elVDBE=; b=bdQZttgo0qSigA5yKFxzRj/OU6xHYIf2/8nkZfAEOdPC+6vzCQINwNSXM19GfCNYSI v3JzgMdMMJC67/j3zYtdPeoJbOpK0ts6N+FgIDCbRL2CWXiNkG2zHCTglQGid8ozemGU /tlc4rwDv1tcY9AHDRZjZLDPXpjuW6Pcgv2TsrETDBxUx6+LujFRL73Zu2pkORAS57e6 c881l0aa1zRMXrkJKwE5VMeFzdNWZj1FmWRzw2qA03WgoIiKZbGA5lxrpwB/tVbLzon4 6BhgvmMHhzXXiWqmfJmZFBzhffjg6Rcl6QJN2gIj6ycGcnoaNepIAm34w9+5uBWbrqsr P6Aw== X-Gm-Message-State: AOAM5305qGBq8liqX3Bej8lZGgZz4mIopAAAgmsLgpeXwR+GNrb+YM9b vNhfXwFHsNgXGavVgHvrUDAPXg== X-Google-Smtp-Source: ABdhPJxOYJ464DlLAzeHDE+jY7tGomWUUjqKWTjqQkQGd6YiBwY0Pj8IoebvvmpqbDvILMfpAg+4Fw== X-Received: by 2002:a05:6e02:1c2f:: with SMTP id m15mr1216618ilh.206.1641447403341; Wed, 05 Jan 2022 21:36:43 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id d16sm616967ioy.29.2022.01.05.21.36.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 21:36:43 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 3616780482E; Wed, 5 Jan 2022 23:36:42 -0600 (CST) Date: Wed, 5 Jan 2022 23:36:42 -0600 From: Justin Pryzby To: Michael Paquier Cc: Kyotaro Horiguchi , peter.eisentraut@enterprisedb.com, pgsql-hackers@lists.postgresql.org, bruce@momjian.us, tgl@sss.pgh.pa.us Subject: Re: GUC flags Message-ID: <20220106053641.GW14051@telsasoft.com> References: <20211209155322.GG17618@telsasoft.com> <20211229023240.GM24477@telsasoft.com> <20220105.114757.369416916044334409.horikyota.ntt@gmail.com> <20220105030648.GE14051@telsasoft.com> <20220105235517.GR14051@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Jan 06, 2022 at 02:19:08PM +0900, Michael Paquier wrote: > On Wed, Jan 05, 2022 at 05:55:17PM -0600, Justin Pryzby wrote: > > pg_settings is currently defined with "SELECT *". Is it fine to enumerate a > > list of columns instead ? > > I'd like to think that this is a better practice when it comes > documenting the columns, but I don't see an actual need for this extra > complication here. The reason is to avoid showing the flags in the pg_settings view, which should not be bloated just so we can retire check_guc. > > + initStringInfo(&ret); > > + appendStringInfoChar(&ret, '{'); > > + > > + if (flags & GUC_NO_SHOW_ALL) > > + appendStringInfo(&ret, "NO_SHOW_ALL,"); > > + if (flags & GUC_NO_RESET_ALL) > > + appendStringInfo(&ret, "NO_RESET_ALL,"); > > + if (flags & GUC_NOT_IN_SAMPLE) > > + appendStringInfo(&ret, "NOT_IN_SAMPLE,"); > > + if (flags & GUC_EXPLAIN) > > + appendStringInfo(&ret, "EXPLAIN,"); > > + if (flags & GUC_RUNTIME_COMPUTED) > > + appendStringInfo(&ret, "RUNTIME_COMPUTED,"); > > + > > + /* Remove trailing comma, if any */ > > + if (ret.len > 1) > > + ret.data[--ret.len] = '\0'; > > The way of building the text array is incorrect here. See > heap_tuple_infomask_flags() in pageinspect as an example with all the > HEAP_* flags. I think that you should allocate an array of Datums, > use CStringGetTextDatum() to assign each array element, wrapping the > whole with construct_array() to build the final value for the > parameter tuple. I actually did it that way last night ... however GetConfigOptionByNum() is expecting it to return a text string, not an array. -- Justin