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 1nvakL-0002Xn-TU for pgsql-hackers@arkaria.postgresql.org; Mon, 30 May 2022 08:27:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nvakK-0006nY-Fv for pgsql-hackers@arkaria.postgresql.org; Mon, 30 May 2022 08:27:28 +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 1nvakK-0006mK-3K for pgsql-hackers@lists.postgresql.org; Mon, 30 May 2022 08:27:28 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nvakH-0002rL-Ce for pgsql-hackers@postgresql.org; Mon, 30 May 2022 08:27:27 +0000 Received: by mail-pj1-x1033.google.com with SMTP id nn3-20020a17090b38c300b001e0e091cf03so7271565pjb.1 for ; Mon, 30 May 2022 01:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=u/4NMdslvsr1KMJ/O0uUqmm3hlkd8E3uHcEBvL1+YX0=; b=SynnnPFJ2mBty5at9Kc6mSltOTX2J4Gf3zOLF9eq2bQdNCBrRq5Fdcx2/Puq3Mgrk2 HeOCKokdi7IN2JbscBw9l5dKxybtBsLogFJNLFeeFgXk9zmR+IT0OVXyVg7Gd6mf2UTG TmNAAhMIb8A/yeI7x2MIR+qFyLS1ylVpbFsXDEqUR7DsXOABps6ndAjfhdMMdD/TgKRi GyC9zPREqKS2xha4FKkBx9pBsa2TS5+/OE9r6VSSvSws/mfDhXuqqV0VVhOhz5o6Tx/V zJg+TEgVHhjQ/YuiKjKDYO/dHtvlb0JB9g6eo3hvn0Oa9PjIRaE3q2WmajDuJeyUaz1n 9G7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=u/4NMdslvsr1KMJ/O0uUqmm3hlkd8E3uHcEBvL1+YX0=; b=BCt3AhHCkvYVRVRzzNeZPdDrubQeSevP9HTcs8KTsa7tK27XCu9kohzloUBe1a84bu dlwFrj5yAY1eQDR9N1grMHZ9SU+JrYEY/DZ3axLvwEBcOJpF7PhN1K9Db8ZqpgSXEk6M neTau8k3yazqHm/6e45pCZYBYhX16vCdvRe2r9iiFnEhBnlNvK2W4kGjuHA1cIgW51G3 1DR//G/9FBOG36AgM6vOUFsnT/wunoKEGCGhGafVR+yAXMwzdGn9/13jE1+sBTWQj5sr 8Y2Jv66TLTGKt/Lo4uguAWwXQgrW/DlQL927cGfEbL2TKHEWDGVBtVqK8gL/sVL//7R5 qwrw== X-Gm-Message-State: AOAM532wWbl5f4IR+LVv3kggRbpofoA4/nomq3AnYXgVH8aDwGfYowJR 88rd0eOtuCllJ0CkdiRP4tU= X-Google-Smtp-Source: ABdhPJxqryzs78Nv2bco7vSQ1Vj+8jZ4L9aSTfP69Lsw/iv9zs+1mygPfy9yim56zkc2hRVeSWOCHA== X-Received: by 2002:a17:903:2448:b0:163:c9ae:f58c with SMTP id l8-20020a170903244800b00163c9aef58cmr6865783pls.60.1653899243099; Mon, 30 May 2022 01:27:23 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id r20-20020a170902e3d400b0015ee24acf38sm1000587ple.212.2022.05.30.01.27.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 May 2022 01:27:22 -0700 (PDT) Date: Mon, 30 May 2022 17:27:19 +0900 (JST) Message-Id: <20220530.172719.867839911471994005.horikyota.ntt@gmail.com> To: andres@anarazel.de Cc: pryzby@telsasoft.com, michael@paquier.xyz, nathandbossart@gmail.com, pgsql-hackers@postgresql.org Subject: Re: fix stats_fetch_consistency value in postgresql.conf.sample From: Kyotaro Horiguchi In-Reply-To: <20220528202245.lrjn3v2m5shzgbsq@alap3.anarazel.de> References: <20220526.130045.1582015671130082847.horikyota.ntt@gmail.com> <20220526.162753.632795261813283794.horikyota.ntt@gmail.com> <20220528202245.lrjn3v2m5shzgbsq@alap3.anarazel.de> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_May_30_17_27_19_2022_009)--" Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ----Next_Part(Mon_May_30_17_27_19_2022_009)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit At Sat, 28 May 2022 13:22:45 -0700, Andres Freund wrote in > Hi, > > On 2022-05-26 16:27:53 +0900, Kyotaro Horiguchi wrote: > > It could be in SQL, but *I* prefer to use perl for this, since it > > allows me to write a bit complex things (than simple string > > comparison) simpler. > > I wonder if we shouldn't just expose a C function to do this, rather than > having a separate implementation in a tap test. It was annoying that I needed to copy the unit-conversion stuff. I did that in the attached. parse_val() and check_val() and the duped data is removed. > > +# parameter names that cannot get consistency check performed > > +my @ignored_parameters = > > I think most of these we could ignore by relying on source <> 'override' > instead of listing them? > > > > +# parameter names that requires case-insensitive check > > +my @case_insensitive_params = > > + ('ssl_ciphers', > > + 'log_filename', > > + 'event_source', > > + 'log_timezone', > > + 'timezone', > > + 'lc_monetary', > > + 'lc_numeric', > > + 'lc_time'); > > Why do these differ by case? Mmm. It just came out of a thinko. I somehow believed that the script down-cases only the parameter names among the values from pg_settings. I felt that something's strange while on it, though.. After fixing it, there are only the following values that differ only in letter cases. In passing I changed "bool" and "enum" are case-sensitive, too. name conf bootval client_encoding: "sql_ascii" "SQL_ASCII" datestyle : "iso, mdy" "ISO, MDY" syslog_facility: "LOCAL0" "local0" It seems to me that the bootval is right for all variables. I added a testing-aid function pg_normalize_config_option(name,value) so the consistency check can be performed like this. SELECT f.n, f.v, s.boot_val FROM (VALUES ('work_mem','4MB'),...) f(n,v) JOIN pg_settings s ON s.name = f.n '. WHERE pg_normalize_config_value(f.n, f.v) <> '. pg_normalize_config_value(f.n, s.boot_val)'; There're some concerns on the function. - _ShowConfig() returns archive_command as "(disabled)" regardless of its value. The test passes accidentally for the variable... - _ShowConfig() errors out for "timezone_abbreviations" and "" since the check function tries to open the timezone file. (It is excluded from the test.) I don't want to create a copy of the function only for this purpose. regards. -- Kyotaro Horiguchi NTT Open Source Software Center ----Next_Part(Mon_May_30_17_27_19_2022_009)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v2-0001-Add-fileval-bootval-consistency-check-of-GUC-para.patch"