Re: make ExecInsertIndexTuples arguments less bad

Álvaro Herrera <alvherre@kurilemu.de>

From: Álvaro Herrera <alvherre@kurilemu.de>
To: Andres Freund <andres@anarazel.de>
Cc: Fabrízio de Royes Mello <fabriziomello@gmail.com>, Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-02-17T18:00:12Z
Lists: pgsql-hackers
On 2026-Feb-16, Andres Freund wrote:

> Personally I'd move the flags to before the slot and the estate before slot
> (because it seems like options should come before the data and the most
> frequently changing arguments should be later on), but that's an extremely
> minor detail.

Good point, I pushed like that.

> I'm mildly surprised about using bits32, we seem to be more widely just using
> uint32 or such.  I find a lot of the typedefs in c.h much more noise than
> useful. But also, whatever.

Yeah, I dunno, maybe we can retire those, but to me they say more
explicitly that the variable is not a number but rather a set of bits.
It doesn't make any actual difference, of course ...  I've tried to prod
others to use bits32 instead of uint32 and have had little (read: none)
uptake, hah.

> > There might be places in executor.h to reuse the f831d4accda0 thingy,
> > but this is probably not it.
> 
> FWIW, when passing <= 6 values, passing the arguments by reference in a struct
> (rather than passing the struct by value), is likely to lead to less efficient
> code.

Noted.

> > @@ -943,11 +946,16 @@ ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo,
> >  		conflictindexes = resultRelInfo->ri_onConflictArbiterIndexes;
> >  
> >  		if (resultRelInfo->ri_NumIndices > 0 && (update_indexes != TU_None))
> > +		{
> > +			bits32		flags = EIIT_IS_UPDATE;
> > +
> > +			flags |= conflictindexes != NIL ? EIIT_NO_DUPE_ERROR : 0;
> > +			flags |= update_indexes == TU_Summarizing ? EIIT_ONLY_SUMMARIZING : 0;
> 
> I'd just make these ifs, this is somewhat hard to read.

Changed that way.

Thanks for reviewing!

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Los cuentos de hadas no dan al niño su primera idea sobre los monstruos.
Lo que le dan es su primera idea de la posible derrota del monstruo."
                                                   (G. K. Chesterton)



Commits

  1. Use a bitmask for ExecInsertIndexTuples options

  2. Add ArchiveOpts to pass options to ArchiveEntry