Re: ON CONFLICT DO SELECT (take 3) - Mailing list pgsql-hackers

From Viktor Holmberg
Subject Re: ON CONFLICT DO SELECT (take 3)
Date
Msg-id 9284d41a-57a6-4a37-ac9f-873cb5c509d4@Spark
Whole thread Raw
In response to Re: ON CONFLICT DO SELECT (take 3)  (Viktor Holmberg <v@viktorh.net>)
Responses Re: ON CONFLICT DO SELECT (take 3)
List pgsql-hackers
On 24 Nov 2025 at 11:39 +0100, Viktor Holmberg <v@viktorh.net>, wrote:
Got a complication warning in CI: error: ‘lockmode’ may be used uninitialized. Hopefully this fixes it.
It did not. But this will.
For some reason, in this bit:

‘''
LockTupleMode lockmode;
….
case LCS_FORUPDATE:
 lockmode = LockTupleExclusive;
 break;
 case LCS_NONE:
 elog(ERROR, "unexpected lock strength %d", lockStrength);
 }

 if (!ExecOnConflictLockRow(context, existing, conflictTid,
 resultRelInfo->ri_RelationDesc, lockmode, false))
 return false;
‘''

GCC gives warning "error: ‘lockmode’ may be used uninitialized”. But if I switch the final exhaustive “case" to a “default” the warning goes away. Strange, if anyone know how to fix let me know. But also I don’t think it’s a big deal.
Attachment

pgsql-hackers by date:

Previous
From: Sami Imseih
Date:
Subject: Re: another autovacuum scheduling thread
Next
From: Tom Lane
Date:
Subject: Re: make -C src/test/isolation failure in index-killtuples due to btree_gist