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 1wFneB-005Yvs-1e for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2026 06:34:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFneA-00HSKL-24 for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2026 06:34:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wFneA-00HSKD-17 for pgsql-hackers@lists.postgresql.org; Thu, 23 Apr 2026 06:34:46 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFne7-00000002NCc-3sZ8 for pgsql-hackers@lists.postgresql.org; Thu, 23 Apr 2026 06:34:45 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2ad21f437eeso41175645ad.0 for ; Wed, 22 Apr 2026 23:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776926083; x=1777530883; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AbUpqFiCnUohCug39ZhzlZoKfh4iD7Mc1z2zBZlKTgI=; b=g6fJ7I338CAv029z/GLSLNXz8+Y75V/x95bTaHZe+OrzwM9/kbbu6yyBIvQXMvaii6 l9I+TtHVcJE8by1Wo8BAzUDD7ide8pWNaQa1BwJBTCOKRu9gPTvydVcAZRFQMgCI4Pe3 UFuFA/VAk4NXnyPd84V1PLkDh1zTocavbV1Vwl9tHiDirRJ9sRr3eR2WsrtcbY0gNXBu tja8KAZLuiOzXNgEDDT4SWvBPTjQg2WjcaVdlpsH6hge7NlCOC9Zu+Oi0aOiwPRpeg5m S1L9OUIvuYx+h0Djl9+SPTERMbkI6IQOz8cy4UCdwDaHjE08UuskAteh819rVRUZ0hmd /ZsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776926083; x=1777530883; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=AbUpqFiCnUohCug39ZhzlZoKfh4iD7Mc1z2zBZlKTgI=; b=PtvvjAJWnprr8kLRCzpujTXz2i0AEls2Jen3F3vekSjOmCEGbZyKhEgWEOCSFVE8uJ C96F59F4s2qEnF2JyO13VaoT2b5pQAeJW+O/gzCRmh3AfAT+Q2yRlxz+byQTxqg937/L 1X1ZdumP6r80Cv3zfV4+3Qg+Rb/pFafxTiVsujtns5cCCz4xbEZrLWfyMtQ3PewrHcSu TMKGMiT3FQEnidQMlRR4G801zG1SeWPqh3GxRCWIReOWEbSOtWtquQ1cLd1+Tj56M6W1 8+AlX+XGGpJ3APHIQMPssXQPbFN7lEPV12yfoCzKSl+dtul0Nz9a91OAkLYQNTIpzG0I vC3Q== X-Forwarded-Encrypted: i=1; AFNElJ/3c2Ei9g7xrnphP0qPR6YXNFtPTmbEJn7QG5U5CMZSFRg5oR6ArkE5hEmF/LSYmjHCgJTUWIG9KPSoR4Ci@lists.postgresql.org X-Gm-Message-State: AOJu0YyUqf5YnUbWa3Kuav1rES6K8lcftIQKtiTWRJNDrP4DVwD9ySfj qjMMY2ZEsQesgzzCxH7c8Ebx4CDgeX+9ijwUijJtLfQJ+q1ecbdqjKys X-Gm-Gg: AeBDievtegONojcie4Y1mp+ZR/Ssda9+C7zGnkxt9UBwyZ2syWHe2TZ/iY5cR3UwbUs KnhtWFMdq9lqojVku7c4c9/7ulv3VtAoWZbZ8//wfrJlbvP1BzCJUoiR+0RuLzJrV0PFgOpqD9P 2g0h6ZoINfYhTx9/TsRwfOcEbeX773VGB63Vru1vqZLMe8q1YpVwJNjopypTQloMnuPcRXhcSMu t4uI05OJmy1PQcIpwS5BavRNLFXiyQ2N9fKOacSG6YKNiSdgpqfkNSQxmNPIK5Lk0awFUNIkuJg faRHNbyPC85RS0FaJjdTdorwj5l0Yt6+kP0nY+qUT1u2Xb5PWJbIIfLk5XJCV81pjRdtKscLXtZ rGMsB0HQhP+1olhJaL4Kedm2mLJILTjC5DZ2PF0r+sQ6slnvXxiKhXtstj8UijfsQAZq8wYTg8I ib2fgxTm9wJ9d6fx7BtcE7BZgVufErqR8Ibfq355UcHQSHtkInGdIL X-Received: by 2002:a17:902:e748:b0:2b4:5d0c:7a85 with SMTP id d9443c01a7336-2b5f9dbcd42mr241894715ad.3.1776926083473; Wed, 22 Apr 2026 23:34:43 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5fab0cdd1sm185378985ad.38.2026.04.22.23.34.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2026 23:34:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: Cleanup shadows variable warnings, round 1 From: Chao Li In-Reply-To: Date: Thu, 23 Apr 2026 14:34:03 +0800 Cc: =?utf-8?Q?=C3=81lvaro_Herrera?= , Postgres hackers , Peter Eisentraut , Peter Smith Content-Transfer-Encoding: quoted-printable Message-Id: <27BB52C6-74C9-462A-8A6C-9DC3531E2146@gmail.com> References: <8B830174-7794-411F-B936-37DDB509EC5D@gmail.com> To: David Rowley X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Apr 23, 2026, at 13:19, David Rowley wrote: >=20 > On Wed, 22 Apr 2026 at 17:14, Chao Li wrote: >> The attached new v1 patch fixes the v19-only shadow warnings. There = are not many. I strictly limited it to warnings newly introduced in v19, = without touching any pre-existing ones, even where an old occurrence is = very close to a new one. >=20 > Thank you. I pushed those after some adjustments. >=20 > While doing that, I did think more on if we should do more of this for > v20. I keep thinking back to the times when I've had to write 6 > different versions of a patch to back patch to 6 different branches. > It's rarely that bad, but it sure does make you swear when the 6th > "git am" fails, especially when you find out that it was for a very > trivial thing, such as a spelling mistake fix. You really have to > fight off the temptation of complacency after the first 3 or so failed > git ams. >=20 > A worse category of problems that this particular set of patches could > cause is no conflict when we want one. I personally always write bug > fixes for master and back-patch them, but if anyone were to work > forward to newer versions, then imagine someone adding some code to a > function that does something with a local variable that's shadowed > globally. If they forward patch that to a version where the local > variable has been renamed, everything compiles and might appear to > work, but it's now the global that's being changed when the new code > was meant to change the local. Maybe no committers work that way, but > if they do, it's a real risk. >=20 > IMO, without any references to recent bugs that have been fixed due to > shadowing, then I can't see beyond the fact that this might be more > likely to cause bugs than to prevent them. As I recall, we were about > borderline on doing -Wshadow=3Dcompatible-local. At least for > non-compatible variables, I'd expect you'd get a warning or error > during compilation. For the record, I got motivated for Justin's work > on the compatible-local due to af7d270dd. I removed a shadowed > variable which was incorrect. In my view, Justin Pryzby's proposal to > do something about this was well timed. I'm not seeing the same thing > happen here. Maybe I missed it? >=20 > David Hi David, Thank you very much for accepting this v19-only patch. I helped prepare back-patch diff files for [1] today, from v10 to v18. = It was only a tiny change, but I still ended up with 3 diff files across = 9 branches, which was quite painful. I can understand that, as a = committer, you probably run into that kind of pain regularly, and would = prefer to avoid adding more of it. I=E2=80=99ll hold off on the rest of this cleanup unless there is a = concrete reason to revisit it in the future. [1] https://postgr.es/21E668C0-CEAE-44F8-B585-319F31883AFE@gmail.com Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/