Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w20xf-000nr1-2V for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 05:57:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w20xd-007Ww6-2o for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 05:57:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w20xd-007Wvx-1g for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 05:57:54 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w20xa-00000000NHh-47Hn for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 05:57:53 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-79a4e5caad6so4179517b3.2 for ; Sun, 15 Mar 2026 22:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773640669; cv=none; d=google.com; s=arc-20240605; b=hWSsHa0d4fpYAqu0isrtF8jPQ1nwtUk1XzdIew3J85SjIqBQWhjQ05JLSBeXLO2AQu /0dCxiy1Ta3Xt0i/qlrmxjtLIEqI1p090bM7Xd6KzQ7DZx2PDH2kfNIgNL7oIhOjbHfz 2//3OZAUNj6m8QZnoAoWC1m1yZMyKnqYqmhtEsnnZUmTGUxDyk128HNs3aEusz4ew2St tDGbln/zED7zDBTknfJj6jq95aLspZlO1NbauWdxEt0xEapS1i7y2sfmOg6SfY5++MB5 s2R7aCIgYjvNrW4eCJaKsqp6vnVlA+xgW9Y49CU6j3eaStB/Tiu1g+gJmWaob4ILcfe2 WGDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kItMU2sXqg1yg6rRcuSXndJALPYhBpNH0oGsju3IDCQ=; fh=difWPyZhf+FMfWnUHiBJsrLSKQJL23D1+3HP+YAZNos=; b=KRwZ4D/fQKVh3KbJF+LCK5HOAZEhyTLWAe5SviL/J2M3GFvjX4N6uI5nWvabSsl5H7 iSJdwVI9qHnPzGRRDQokOlnMIlGHVRm6dtI1WRvp/nqf8JBYQzM310ZhASk4FfjDYI/8 wVTiLX/rl7Y2Wnhq98UGj2prDDxXkYZkGZZWBQiwuSq4aAplrsqA5w+51kDLadtB5Cv6 kNpJsgtsDL7No0ZLWhSz4qcFbtlxgnaNmG2C1CbJ5xN3xpFAB/J3siZbVax8HTxV4XKR rlTq1nbKLd68RFKHVnHdWBdI9dFxDiOFfHdZBJMr3Zgj7mCmV5NLQ2FIZZtRU78C+vL5 bsWw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=percona.com; s=google; t=1773640669; x=1774245469; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kItMU2sXqg1yg6rRcuSXndJALPYhBpNH0oGsju3IDCQ=; b=NFyeBtTAMW1BFQgIlY9vWUIV+IRHtsnAc1dlInbg1MYFX+HBkh7+UPdUA8PEk6/nJz MNzahdefYkwygk7biHQ+br7iFm4xaqqkK13yzBI6RALW6Cf33LYIr+9MfnQ4a759jBLi syfdJWM0I9DqbPiD9t4prAC8HbkY8X7SiqF5E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773640669; x=1774245469; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kItMU2sXqg1yg6rRcuSXndJALPYhBpNH0oGsju3IDCQ=; b=hfCukQDu0qKa0FHlSlrdH54XZngCrkgqR+RcRFRd8bCol+EihQ2cHxjo5e32khd01Q b5hRjOimLhT7aKO6MRCCHzCjabJ+AS1hi/1VkvAukBYjw7pKl8+p5qXXdVYq4qNfsMiF mBhaem7AVTEknRD6TgsYgiqfZO40NU0lN1hFQV5Tcu4LYhHHilkE7bQ2OAg/nM9KSW5G ZPHdGnfV6RkIzzmugkpy2bMURuJItd1x0fu1c/6nZL5dUYgmvpJznJQSOcyfUznWR0j/ jGCL5XYCeV8QdWUz5hALf/ZsxGCWqBpgNTzw9te6/3+IKxetm9mEZppcSoG7g7QIWnTP UvCA== X-Gm-Message-State: AOJu0Yz5Ws55Dzkysv3sBJXjHe3USrV5+BPji3EAVgvtiuwJGm8ALyfh uW/ga2Xb5GY6s5DfOEyqChZqD95RlOhMFu0iFtBWINjV5wpzEm6DVbix32mtdcTQiIX2GJ6c2tn 76H0l4Es+n2OygdjamfQkDP6tE8/WRnRMlzo5DfH8s/4FjrBk//qJCm5x4OQDWMPBgSDY0n77nz VHSdC0VPjoUueeuv8nh6cLpXnS601xgmc6RuzwVGVAmdIXiwf7KRkGM379L7CitWlKxVVAsAUMJ OUvMOOcUoXDqRH89woY+Zd0MQxp62FgMs6Lo1HJ/l1GOwX+thEFn8kIhZVB1YpJeYA= X-Gm-Gg: ATEYQzyeRY2vZoo5g4Oj7g1opiyCLKMm7r6R0ZoX487r+bHJ4r5aObr4TEWqvfy7LcA CCNQj+pIqCbcBdto99DY/OM5Ktk9D6/JutrH03N81Qk2Md6vdaPP5a/57b4kDLOoILNsRVNiLj3 K6tKxQkbH72+sYVdyKc3J+4hQhiLoZv3TBaShQwq1Dab/sU/zxrICJ433L8wFcfLQC+iCTNtQtV LQKyXqsHc0EZJxHnFCCxW4VJ+rEiqaY6ptZldcBRTF9nW7x5q8XndWmUwSIiMlHhS56qbOGJW80 iHyhBWxQ54gEjxsIKv0MXJDcryfOJ8R8okikORZZSujYt+y+MSYrFfiQWNdNmzGIKAzC X-Received: by 2002:a05:690c:92:b0:798:6a6b:5b0f with SMTP id 00721157ae682-79a1c1acae3mr120351107b3.32.1773640669279; Sun, 15 Mar 2026 22:57:49 -0700 (PDT) MIME-Version: 1.0 References: <41FFF107-16B6-4B5A-BFDF-88AEF4B776F4@gmail.com> In-Reply-To: <41FFF107-16B6-4B5A-BFDF-88AEF4B776F4@gmail.com> From: Zsolt Parragi Date: Mon, 16 Mar 2026 05:57:39 +0000 X-Gm-Features: AaiRm53Y8w51BeYQyWGzVhTLPa0WcpCoUIgyhPaHqFdWfFoYZauiqVcE9O-EBbk Message-ID: Subject: Re: gen_guc_tables improvements To: Chao Li Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: percona,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Mar 15, 2026 at 10:27=E2=80=AFPM Michael Paquier wrote: > I'd say no on this one, which would mean going back-and-forth with the > input. If these fail due to a compilation failure, it's not that bad > either, it would be easy to pin-point that the failures are related to > the values of the GUC, not the overall shape of the data in the input > file. Saying that, it would depend on how much complexity this adds > and what kind of validation we'd get out of it. If the additions to > the script are simple like the ones you are proposing here, that would > be probably OK if these improvements catch a bunch of ground-breaking > inconsistencies. If the whole script would need to be refactored, > probably not. We can have two kinds of errors: 1. A typo in an enum name - this will result in a compilation failure most likely, and the compiler will provide nice error messages with the fix suggestion (e.g. GUC_NOT_IN_SAMPLE -> GUC_NOT_NI_SAMPLE, or PGC_SUSET -> PGC_SUSTE) 2. a mismatched enum because of a copy paste mistake (group says PGC_SUSET instead of WAL_ARCHIVING, or boot_val says WAL_ARCHIVING instead of ARCHIVE_MODE_OFF). The examples I provided there aren't likely copy-paste errors, that one is when you copy-paste an existing enum guc and forget to change its boot value. (2) currently compiles without warnings in both cases, but it is also usually easier to spot during review. The patch itself would be well contained: one or two utility functions (GUC_NOT_IN_SAMPLE and other flags are defines, not enums), and then calling them at a few places. So it's not a significant refactoring. But I'm also not a fan of parsing C source code in perl, that's what I meant by fragile. It seems to work, but I wouldn't guarantee that it can properly parse all edge cases. Thinking about this more, these checks would better be implemented as a custom clang-tidy check for example, which I already started to look into for another issue. On Mon, Mar 16, 2026 at 3:13=E2=80=AFAM Chao Li wr= ote: > I think dot is allowed in a GUC name. Looking at the C code: Yes, but by convention dot is only used by extensions to mark the prefix/namespace of the extension (.). None of the core server GUCs use it. The point of this script isn't to ensure that the generated C code will compile, but to prevent hidden errors and ensure we follow existing proper coding conventions. > BTW, I have similar patch [1] that verify duplicate GUC enum values. I forgotten about that, thanks for the reminder! I didn't like the runtime check approach of it, and I think there are more exceptions than the whitelisted items in the patch, but adding the ability to mark a guc value list unique could be another good candidate for a custom clang-tidy check. (assuming people like my clang-tidy idea, which I didn't even start a thread about yet)