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 1w5Eh8-0032dQ-31 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 03:14:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5Eh7-00AyZ2-13 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 03:14:09 +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 1w5Eh6-00AyYu-2x for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 03:14:09 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5Eh5-00000000tcZ-1wmE for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 03:14:08 +0000 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-35a094cc3e9so4092549a91.3 for ; Tue, 24 Mar 2026 20:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774408446; cv=none; d=google.com; s=arc-20240605; b=L0TGo6OtzIJkB4WaDZRA2aiUEvK5k4oMI9nzVYCne49LxWTIhULu3NdC88W/4aqeTf PgwjFRmctuGwpFEZIG6HbrpkywIqsymbuacpEvrdcWBb3jzMKXvMP1uIXtWuCEvNxiDN RoESkHyKYTP7UZdrVW0QdzYoIgEBa1cwKB19sA3jpVJNU7FHvPcbjBHNZr+gXInBwDiD +pFpqZrf0lPam6H8dFPdfS1ZV23MzyKxiLCrllXqYJvkxoAOXobNFZ2vYAPDlDzSqraE npGNfBXJ6QdHA50VI4O9ohI5LpUQw2b0IyWgLi01GM/y5zJ0XTAufantC9VQLRcOO1ld re/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=fqPY4+46CzHA7z3GSjDlNuxLFLunOXpZKIZRTyRGlb8=; fh=DoWjJAP9M3SzF8HFQmBol3cdvS3vDn7qhFQgqnlJuxY=; b=PAR8oGmQJgzwiW61SJywUxF0V3byEYWZ4vLCjpTk8R7Ax70eyVLnt8ugSRnhscJhnV IurNZFw85yZvzPA8XYityh24WJFCznmITkto8DMCce/Am8EbthAHAG96f2BSIuvb8woC 1cqFs5DZoSNZaWVyOhMapNOR1sNa5qcPVQ1S9yQpsOLqCjXH81cSp2zL56xGeIor5Cnq 13EyZnHGBrG7H6iSVeGLixb9is1qmFlYsNT4FV5HqciyhWLit0k6UXrnN1WSsBmWPend fysb6LFLcuBC6ecAcROsydTx4MBn5M7CUZkPIRx5pzAcMRALxLP+epgGdQMLBz2Rb2lM CfSA==; 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=gmail.com; s=20251104; t=1774408446; x=1775013246; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fqPY4+46CzHA7z3GSjDlNuxLFLunOXpZKIZRTyRGlb8=; b=dbXlH0rGZzg9NJiESpoW5sjLq9QgbvEa6pGv5w3ZgiAy3KBga94vntIJOI8nH24/Uk yqoo8OEmbHM1DurOSbv2edg5NHO+Edcq3eJxr2Wb5tXrcVa0O6KoG9bAFtcsrBKz6F1S t1f4CdvlPvbTaU0Dh2ddLX+i9aTyOwmyNCHYvuMjjptgnDDLwHJMu/2potiXjMhXRWkE HR5yEj3DDP87W1LM7ot7O3M5jsPAsZvAfe/8NjxStIf/hCQ0mb7ZhmvfF3YXJ9ah4cPk fybrGrCYTamQBeQ/2ZF7GsoBp3goLhpADMx6qZqc0MmE3tvZbrzYsJ8rfwKcWC+/JESM F3Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774408446; x=1775013246; h=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=fqPY4+46CzHA7z3GSjDlNuxLFLunOXpZKIZRTyRGlb8=; b=VwDR5L7/tgmuBMHdPZW3KwHpsN+Wl5CdLW4tF+d/nTnGiwFgkmFJc2a7i7m4A/wK5z nh6oOcClrMt7jKKB1QZxLO+MBOHdLpHeSdfhRkPVy2a2NNd1fd0vmBEsVifH/2HexAxU TUlTrgpAuEV2hMshUxwsor56ct/GXObt8iF9GM/46PT1iKL12secqrJVYTecQp9BP+tU yAgp/0RAM3XECDzS7qTz/XSOpGNwoPKN6yzp5Y5ueR7mh+9ytOm9R363R8gJhs2g/FH5 2tpdvraxnNP8mQh2YPcszhHLkDvvcBWma/9cCZ9SN9JShNUhLFUqoF/+xmkugxUdmA9B QDng== X-Forwarded-Encrypted: i=1; AJvYcCUjaGzzOCSSW2cFJPXq67CBhn8l1tG+QfNXKSoy8007rjPFnYpw5q0nBE8DyIn/QC1ocoWLFio3kapiUtzL@lists.postgresql.org X-Gm-Message-State: AOJu0YxPzutFotayIzg3YmC9KeTVie9RKrB/QS7X5PT/WSuuhJCSosos iMZwPRJ7T7r42yBsijEwJoCal36R9lx5FBHcwcDLDfnAT24bWy23cjzyuipDTVv0tBUuj3i8f1P 8SkEzUERykc/9cx97HAsOJNmkvAT+9iU= X-Gm-Gg: ATEYQzyEB/itpeZ7g63P5fFTT7XZEn+/s5WbxvlghBIoxJsyc7nV06KTpmPe4IDfs7t /Cfkr3cxHK7DxR8f+07r32TQemWLc1vTtygbEVuy5LkJxrPab7673ndFFesuIcNERuuLmFTkBxZ jcI0JW7pE1Dg7sEh6s6fBmpJI+NPKqdOSzUiJoo8OI9SmyNJ1zfDsh2um5hT8HrPgHOlX4Uooia csOa6v4SGPf48pUpnbhQvl5GSfa2QGUaSU4cXTyZJZglQQHDkxrA9Zm7scofyWwgc0jRBNHx5iP I5QIVxv+ X-Received: by 2002:a17:90b:4a03:b0:35b:e5b4:b4c5 with SMTP id 98e67ed59e1d1-35c0dd95c1amr1521154a91.25.1774408446392; Tue, 24 Mar 2026 20:14:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Langote Date: Wed, 25 Mar 2026 12:13:55 +0900 X-Gm-Features: AaiRm52YsvxRVQMgglyAT_2IcAf3YqwltnEK1zFE1seNc87WgE4D8dsjDy7QApY Message-ID: Subject: Re: [PATCH] Fix wrong argument to SOFT_ERROR_OCCURRED in timestamptz_date To: Nathan Bossart Cc: Jianghua Yang , pgsql-hackers@lists.postgresql.org, peter@eisentraut.org, jian.universality@gmail.com Content-Type: multipart/alternative; boundary="000000000000223e08064dd0a91c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000223e08064dd0a91c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 25, 2026 at 5:53 Nathan Bossart wrote: > 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 =E2=86=92 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, an= d > I got the following warnings: > > execExprInterp.c:4964:27: warning: incompatible pointer types passing > 'ErrorSaveContext *' (aka 'struct ErrorSaveContext *') to parameter of ty= pe > '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 ty= pe > '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. That seems ok to me. [... 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%40postg= resql.org ISTM the fix proposed by Ishii-san in that thread is the same thing, but yours LGTM too. - Amit > > --000000000000223e08064dd0a91c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=C2=A0On Wed, Mar 25, 2026 at 5:53 Nathan Bossart &l= t;nathandboss= art@gmail.com> wrote:
On Tue, Mar 24, 2026 at 08:44:29AM -0700, Jianghua= Yang wrote:
>=C2=A0 =C2=A0I found a small bug in commit e2f289e5b9b ("Make many= cast functions
> error safe").

Nice find.=C2=A0 For future reference, since this was just committed, it might've been better to report it directly in the thread where the chan= ge
was discussed.

>=C2=A0 =C2=A0The fix is a one-line change: fcinfo->args =E2=86=92 fc= info->context.

LGTM.=C2=A0 To prevent this from happening in the future, I think we ought = to
change SOFT_ERROR_OCCURRED to a static inline function.=C2=A0 I tried that,= and
I got the following warnings:

=C2=A0 =C2=A0 execExprInterp.c:4964:27: warning: incompatible pointer types= passing 'ErrorSaveContext *' (aka 'struct ErrorSaveContext *&#= 39;) to parameter of type 'Node *' (aka 'struct Node *') [-= Wincompatible-pointer-types]
=C2=A0 =C2=A0 =C2=A04964 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0if (SOFT_ERROR_OCCURRED(&jsestate->escontext))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^~~~~~~~~~~~~~~~~~~~
=C2=A0 =C2=A0 ../../../src/include/nodes/miscnodes.h:54:27: note: passing a= rgument to parameter 'escontext' here
=C2=A0 =C2=A0 =C2=A0 =C2=A054 | SOFT_ERROR_OCCURRED(Node *escontext)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^
=C2=A0 =C2=A0 execExprInterp.c:5200:26: warning: incompatible pointer types= passing 'ErrorSaveContext *' (aka 'struct ErrorSaveContext *&#= 39;) to parameter of type 'Node *' (aka 'struct Node *') [-= Wincompatible-pointer-types]
=C2=A0 =C2=A0 =C2=A05200 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (SOFT_ERROR_= OCCURRED(&jsestate->escontext))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0^~~~~~~~~~~~~~~~~~~~
=C2=A0 =C2=A0 ../../../src/include/nodes/miscnodes.h:54:27: note: passing a= rgument to parameter 'escontext' here
=C2=A0 =C2=A0 =C2=A0 =C2=A054 | SOFT_ERROR_OCCURRED(Node *escontext)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^

I think we just need to add casts to "Node *" for those.=C2=A0 AF= AICT there
isn't an actual bug.

That seems ok to me.

[... looks for past discussions ...]

Ah, I noticed this thread, where the same lines of code were discussed:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 https://postgr.es/m/flat/20240724.155525.366150353176322967.ish= ii%40postgresql.org

ISTM the fix proposed by Ishii-san in that thread is the same thing,= but yours LGTM too.

- A= mit
--000000000000223e08064dd0a91c--