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 1w58kW-002wAr-1s for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 20:53:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w58kV-008tGe-02 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 20:53:15 +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 1w58kU-008tGV-1z for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 20:53:15 +0000 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w58kT-00000000qul-18y9 for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 20:53:14 +0000 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-40f1a1f77a6so4019877fac.2 for ; Tue, 24 Mar 2026 13:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774385593; x=1774990393; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=TKn7HRium1RaOxchuIaKpyt4chVbDp7hPS4qUtITlrc=; b=CqEw0mUXBOVKuGE6Ve9Y+Q/4Cq4GN0oocFAo3n2ouH3ILdnXKKWUKveDtZD5ezVDUM wAIYCwx1brlRum4pw0o0xF1Qg+clqOfwAzigLClhpfhRX0o/SVw7qrquGEQekiKf8F0W CffLnilfetJOkgcRFTUVo3sLnZlNUq5gmCjMXWvMv+Y0JxkZNQF6wbiDCBzZdMqCNADC 9xRP7TSlgCMME1pWkrmz91ZLV+mhIYBf6IQGGFdPxdEecLPlRnmOYJ0F/Ye1cdkLAz6i OUvuO5/5U9antu5NCskOVy0529zSLy9KNRsoMlLGvoUTP7TVK/wnDsUdJQsWZyB8uyal +hxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774385593; x=1774990393; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TKn7HRium1RaOxchuIaKpyt4chVbDp7hPS4qUtITlrc=; b=ruSK8w/IllqXHNdB1ymq4YVBG8GxiF/2+FWku5miIAbYddOsvg4SqpfiU2larOUqoC e9rWWI5Bh4z0I/lWioPR4cel8Vdl943vz1ojwyLfwBVNqyi2Y3h+P9F2gvbQpGKszYis ClDpF1omElgk+eK37dSGIj+CY24cN+UfEPwfLQNY/S5frKgKCyJRlUCxrPRimWjCRwaL l690umaLx6LmyYplbmSy1bZLOtR5LiqvzeeYjVsCCa5A2bdGJ1IyXngjl7AYG47YvWBE +/MCBLsvqh9yL6p2lJmiGBvn1DiKvEzYik2EErjKRd8PsI+axvSJG4WFCC2emOR+nej1 UUJA== X-Gm-Message-State: AOJu0YwReESV+7VuX2OuEAb9UQxJ+s1lTEmeImA+CizGSy+H0DktoglO Rio/CpGI74+Xt6gI0gCAQDdQU1HOQhwOjFyNua9f5cdG+jM3IFWSTnF+ X-Gm-Gg: ATEYQzxTA+IAYEIBSxySCaT9IiVWMkXrV/DHEvW/s5gDJTmZDeMD/lsX4y43sle6Z0n ztftRNL7nV+OJq4TOd1Q0RVhjKLGoyQAt3UvcuEpyj7q71dWzkz5puG1Jdyjvq95wsduZiZWQWY XwQksQWQ17znJq5UlFAWUlFha8uk/idLBVENi7uitTbBN82IDY/BK+R1Wb41GQ1YA85JO0pxtQW K1cYdajLkvSOvpwqkZ/Irp31DP/eQiyiR7i63xvmqe9YYjoRot8FpoPFxC9GO3hzSemgxyGfNJ/ 38/AXqSgMJeoZAbzeHILidf1agyarEeqfKlufE9LmqHH56hS19DGBBg04wlzPqVbPNp/5QDU4Xg wUsJOWmeuY/mEJtIBrW4D5SY+XdeKmMiYpwRxHMbBzM+/koqu122SiLe6QBd/qKtfO8S8EF92uo y1UtytoNaL6D7tE9q5secrOX8XGC16ifs2/yhZol/c5OOsU9PEL4Y0S0wkBC9COGbmdizL7OQ/z V2jfv5bMY3GUQhJfDZ0tg== X-Received: by 2002:a05:6870:5ba1:b0:3f5:5af:c9de with SMTP id 586e51a60fabf-41ca71941a9mr670284fac.51.1774385592616; Tue, 24 Mar 2026 13:53:12 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-41c14d73a19sm13359477fac.11.2026.03.24.13.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 13:53:12 -0700 (PDT) Date: Tue, 24 Mar 2026 15:53:10 -0500 From: Nathan Bossart To: Jianghua Yang Cc: pgsql-hackers@lists.postgresql.org, peter@eisentraut.org, jian.universality@gmail.com, amitlangote09@gmail.com Subject: Re: [PATCH] Fix wrong argument to SOFT_ERROR_OCCURRED in timestamptz_date Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="X83H52P7q57jdRYd" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --X83H52P7q57jdRYd Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Tue, Mar 24, 2026 at 08:44:29AM -0700, Jianghua Yang wrote: > I found a small bug in commit e2f289e5b9b ("Make many cast functions > error safe"). Nice find. For future reference, since this was just committed, it might've been better to report it directly in the thread where the change was discussed. > The fix is a one-line change: fcinfo->args → fcinfo->context. LGTM. To prevent this from happening in the future, I think we ought to change SOFT_ERROR_OCCURRED to a static inline function. I tried that, and I got the following warnings: execExprInterp.c:4964:27: warning: incompatible pointer types passing 'ErrorSaveContext *' (aka 'struct ErrorSaveContext *') to parameter of type 'Node *' (aka 'struct Node *') [-Wincompatible-pointer-types] 4964 | if (SOFT_ERROR_OCCURRED(&jsestate->escontext)) | ^~~~~~~~~~~~~~~~~~~~ ../../../src/include/nodes/miscnodes.h:54:27: note: passing argument to parameter 'escontext' here 54 | SOFT_ERROR_OCCURRED(Node *escontext) | ^ execExprInterp.c:5200:26: warning: incompatible pointer types passing 'ErrorSaveContext *' (aka 'struct ErrorSaveContext *') to parameter of type 'Node *' (aka 'struct Node *') [-Wincompatible-pointer-types] 5200 | if (SOFT_ERROR_OCCURRED(&jsestate->escontext)) | ^~~~~~~~~~~~~~~~~~~~ ../../../src/include/nodes/miscnodes.h:54:27: note: passing argument to parameter 'escontext' here 54 | SOFT_ERROR_OCCURRED(Node *escontext) | ^ I think we just need to add casts to "Node *" for those. AFAICT there isn't an actual bug. [... looks for past discussions ...] Ah, I noticed this thread, where the same lines of code were discussed: https://postgr.es/m/flat/20240724.155525.366150353176322967.ishii%40postgresql.org -- nathan --X83H52P7q57jdRYd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v2-0001-change-SOFT_ERROR_OCCURRED-to-a-static-inline-fun.patch