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 1vvXZC-006zHA-2K for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 09:21:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vvXZB-00BRnJ-1i for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 09:21:53 +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 1vvXZB-00BRnA-0m for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 09:21:53 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vvXZ7-00000001Mkn-22tG for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 09:21:52 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2aae146b604so4620745ad.3 for ; Thu, 26 Feb 2026 01:21:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772097708; x=1772702508; 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=M1zWSdtnUjUPZ4N+Kr1ltajWQPSCHAs50dKGVp+uXgc=; b=UE2t9CJwMXUgghVClK1iL1/prE+sIgNuhNU3tS7NRkFaIcTAto2mk6LswRukHLaOqD K2W7szgqfPvzZHDbm/zeonqwB4cC6KymoQCDcyz6QWbTfZwsqnCZpm+BM6nJmyhWsmkR yHnOmWANlr1ctm+Bo+II5RTiWoLqRWWaSPaQAx2wzocoFcl4XE7jDm870adwMBrOykt5 MRxgg8UAlcztS7c7tujv7Brs0vkZBRTueep6jzmZ0QRr02b6zO5y2d20gX0SgXh3HLl+ qGOdeK31te3sJOKzsOm/NXfsTdx6YXrb2a1CF1D1zLsTke213ZHYgWJM3nLTKy+fTy9A 9aLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772097708; x=1772702508; 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=M1zWSdtnUjUPZ4N+Kr1ltajWQPSCHAs50dKGVp+uXgc=; b=TmklpKMvzFg9fh/49N5IfGO2j/prI1iZmd62lSXB9aGVtyaLvJCiOZgUO2uHR3HUBd EoJAIBh2CursmhlXr3PiFSJiPSKzqofjLy7jkDXajc2xciTl5JbJWxpbsd5Yiy0NA3Mc xQU1DkaRYEBEvFFWKrUt9H5qr3fEQsyi16QALkkWuH4ZG06eQQ95/Wfi8+Ekp6LyXDOw Y7YmsvkNW7loZ/svP1CDqjMp7oYBjJftU4IflsU090l0IkojA2qv60FSlKlpeFgm20Ah SNO5pw07sNCG9zzscd6ss5pElxUr9bFeQoHs85pn52ULPh91wLvUfZ1zi/AhkzQmzr74 FrdQ== X-Gm-Message-State: AOJu0YywZhl1hy1argKhhK4b4tP6guifXfysPUgDeFHgRDtDnkej18bW IFpr67oUvhV7+P+FAp1/KKEC7Wcb1dvCvTvrALvt3pqmkxMz33p4PHEKh8dC7w== X-Gm-Gg: ATEYQzy0Ks5LfOAsANmmOk8pACLFiblGMClfhg85kWVU4EK5JxScOB4YXdpYJcOx0dx Ay2fvaKx5xQs/sIFfSk2xtEGxtzK1MgExhpFM7zyEvVFzT+iFAZFLZBbrBa4cYO0JPC2v+VQhMf RmUq/WeDr2xF1yV0BHemLle92wrbhXwByWDPCnRSPaNjwzVeinzMku0y8a7neTU35g9erG1LtgW sDxMK/6oCnamxfbeFYkZOLXSGtHlHgbjSElZ0JqQ4zzzq8PGSySUEc5a/hTF/qp84MRglLUIivI /e1r1v69FB1IeI/4zFw0YjwC/cA73kBzkQEoKeYTV5f+bF3XQrktJmQPYnzeDnwqi7uTFopMl5s yq+sccpGIL3/z4u+lmxQgzSa3xtFPJpx7gHHva23dWzQ6YidPjrQxBktuPwSjYZtS+3amHOcPzW 6qP783yVbrBPnUijkh7WAilen7+CYWnXWXVmx2k+8W X-Received: by 2002:a17:903:41c1:b0:2a3:bf9d:9399 with SMTP id d9443c01a7336-2ad744e280bmr187462225ad.35.1772097708380; Thu, 26 Feb 2026 01:21:48 -0800 (PST) Received: from smtpclient.apple ([203.10.98.27]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb5c100csm19947995ad.23.2026.02.26.01.21.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Feb 2026 01:21:47 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: guc: make dereference style consistent in check_backtrace_functions From: Chao Li In-Reply-To: Date: Thu, 26 Feb 2026 17:21:13 +0800 Cc: pgsql-hackers@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <08805314-299A-4941-B63E-4CC3E144E0E7@gmail.com> References: To: zhanghu 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 Feb 26, 2026, at 15:03, zhanghu wrote: >=20 > Hi, >=20 > In check_backtrace_functions(), most accesses to the input string = follow the pattern (*newval)[i]. However, the empty-string check is = currently written as: >=20 > if (*newval[0] =3D=3D '\0') >=20 > While functionally correct due to how the compiler handles the = address-of-address context here, this form is semantically misleading. = It relies on implicit operator precedence rather than explicit intent. >=20 > The attached patch rewrites it as: >=20 > if ((*newval)[0] =3D=3D '\0') >=20 > This change ensures semantic clarity and maintains a consistent = dereferencing style throughout the function. No functional changes are = introduced. >=20 > Regards, > Zhang Hu > This is an interesting find. [] has higher precedence than *, so: - (*newval)[i] means to get the first string, then get the char at = position i - *newval[i] means to get the array element at position i, then get the = first char When i is 0, (*newval)[0] and *newval[0] happen to yield the same = result, so this isn't a functional bug. However, in the GUC context, newval is a point to a string rather than a = two-dimension char array, *newval[i] is meaningless, so +1 for fixing = this to improve readability. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/