public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: Jianghua Yang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Subject: Re: [PATCH] Fix wrong argument to SOFT_ERROR_OCCURRED in timestamptz_date
Date: Wed, 25 Mar 2026 14:18:00 -0500
Message-ID: <acQ06D_Lz6V93gDg@nathan> (raw)
In-Reply-To: <[email protected]>
References: <CAAZLFmSGti716gWeY=DCZ9TTVOixnHZ4_4V4tDzoeE86D64vOA@mail.gmail.com>
	<acL5tt3tfsyDql9x@nathan>
	<[email protected]>

On Wed, Mar 25, 2026 at 07:17:15AM +0100, Peter Eisentraut wrote:
> On 24.03.26 21:53, Nathan Bossart wrote:
>> 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.
> 
> Or maybe we change the escontext field to be of type Node *?

I started looking at this, but it seems to be a rather invasive change for
the level of gain.  Not only does it require more memory management, but we
then have to cast it many places like this:

    ((ErrorSaveContext *) jsestate->escontext)->error_occured = false;

If we instead make it an ErrorSaveContext *, we'd still need to cast it to
Node * for SOFT_ERROR_OCCURRED, unless we had it accept a void * or
something, which defeats the purpose.

-- 
nathan





view thread (5+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Fix wrong argument to SOFT_ERROR_OCCURRED in timestamptz_date
  In-Reply-To: <acQ06D_Lz6V93gDg@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox