Fix vicinity of tuple_insert to use uint32, not int, for options

Oversight in commit 1bd6f22f43: I was way too optimistic about the
compiler letting me know what variables needed to be updated, and missed
a few of them.  Clean it up.

Author: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/40E570EE-5A60-49D8-B8F7-2F8F2B7C8DFA@gmail.com
This commit is contained in:
Álvaro Herrera 2026-04-01 18:14:51 +02:00
parent f7f4052a4e
commit ec2f81766a
No known key found for this signature in database
GPG key ID: 1C20ACB9D5C564AE
13 changed files with 19 additions and 19 deletions

View file

@ -117,7 +117,7 @@ toast_compress_datum(Datum value, char cmethod)
*/
Datum
toast_save_datum(Relation rel, Datum value,
varlena *oldexternal, int options)
varlena *oldexternal, uint32 options)
{
Relation toastrel;
Relation *toastidxs;

View file

@ -94,7 +94,7 @@ heap_toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative)
*/
HeapTuple
heap_toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
int options)
uint32 options)
{
HeapTuple result_tuple;
TupleDesc tupleDesc;

View file

@ -498,7 +498,7 @@ RelationAddBlocks(Relation relation, BulkInsertState bistate,
*/
Buffer
RelationGetBufferForTuple(Relation relation, Size len,
Buffer otherBuffer, int options,
Buffer otherBuffer, uint32 options,
BulkInsertState bistate,
Buffer *vmbuffer, Buffer *vmbuffer_other,
int num_pages)

View file

@ -618,7 +618,7 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
}
else if (HeapTupleHasExternal(tup) || tup->t_len > TOAST_TUPLE_THRESHOLD)
{
int options = HEAP_INSERT_SKIP_FSM;
uint32 options = HEAP_INSERT_SKIP_FSM;
/*
* While rewriting the heap for VACUUM FULL / CLUSTER, make sure data

View file

@ -253,7 +253,7 @@ toast_tuple_try_compression(ToastTupleContext *ttc, int attribute)
* Move an attribute to external storage.
*/
void
toast_tuple_externalize(ToastTupleContext *ttc, int attribute, int options)
toast_tuple_externalize(ToastTupleContext *ttc, int attribute, uint32 options)
{
Datum *value = &ttc->ttc_values[attribute];
Datum old_value = *value;

View file

@ -101,7 +101,7 @@ typedef struct CopyMultiInsertInfo
CopyFromState cstate; /* Copy state for this CopyMultiInsertInfo */
EState *estate; /* Executor state used for COPY */
CommandId mycid; /* Command Id used for COPY */
int ti_options; /* table insert options */
uint32 ti_options; /* table insert options */
} CopyMultiInsertInfo;
@ -401,7 +401,7 @@ CopyMultiInsertInfoSetupBuffer(CopyMultiInsertInfo *miinfo,
static void
CopyMultiInsertInfoInit(CopyMultiInsertInfo *miinfo, ResultRelInfo *rri,
CopyFromState cstate, EState *estate, CommandId mycid,
int ti_options)
uint32 ti_options)
{
miinfo->multiInsertBuffers = NIL;
miinfo->bufferedTuples = 0;
@ -535,7 +535,7 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo,
else
{
CommandId mycid = miinfo->mycid;
int ti_options = miinfo->ti_options;
uint32 ti_options = miinfo->ti_options;
bool line_buf_valid = cstate->line_buf_valid;
uint64 save_cur_lineno = cstate->cur_lineno;
MemoryContext oldcontext;
@ -792,7 +792,7 @@ CopyFrom(CopyFromState cstate)
PartitionTupleRouting *proute = NULL;
ErrorContextCallback errcallback;
CommandId mycid = GetCurrentCommandId(true);
int ti_options = 0; /* start with default options for insert */
uint32 ti_options = 0; /* start with default options for insert */
BulkInsertState bistate = NULL;
CopyInsertMethod insertMethod;
CopyMultiInsertInfo multiInsertInfo = {0}; /* pacify compiler */

View file

@ -56,7 +56,7 @@ typedef struct
Relation rel; /* relation to write to */
ObjectAddress reladdr; /* address of rel, for ExecCreateTableAs */
CommandId output_cid; /* cmin to insert in output tuples */
int ti_options; /* table_tuple_insert performance options */
uint32 ti_options; /* table_tuple_insert performance options */
BulkInsertState bistate; /* bulk insert state */
} DR_intorel;

View file

@ -49,7 +49,7 @@ typedef struct
/* These fields are filled by transientrel_startup: */
Relation transientrel; /* relation to write to */
CommandId output_cid; /* cmin to insert in output tuples */
int ti_options; /* table_tuple_insert performance options */
uint32 ti_options; /* table_tuple_insert performance options */
BulkInsertState bistate; /* bulk insert state */
} DR_transientrel;

View file

@ -6195,7 +6195,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap)
EState *estate;
CommandId mycid;
BulkInsertState bistate;
int ti_options;
uint32 ti_options;
ExprState *partqualstate = NULL;
/*
@ -22835,7 +22835,7 @@ MergePartitionsMoveRows(List **wqueue, List *mergingPartitions, Relation newPart
ListCell *ltab;
/* The FSM is empty, so don't bother using it. */
int ti_options = TABLE_INSERT_SKIP_FSM;
uint32 ti_options = TABLE_INSERT_SKIP_FSM;
BulkInsertState bistate; /* state of bulk inserts for partition */
TupleTableSlot *dstslot;
@ -23226,7 +23226,7 @@ createSplitPartitionContext(Relation partRel)
* deleteSplitPartitionContext: delete context for partition
*/
static void
deleteSplitPartitionContext(SplitPartitionContext *pc, List **wqueue, int ti_options)
deleteSplitPartitionContext(SplitPartitionContext *pc, List **wqueue, uint32 ti_options)
{
ListCell *ltab;
@ -23268,7 +23268,7 @@ SplitPartitionMoveRows(List **wqueue, Relation rel, Relation splitRel,
List *partlist, List *newPartRels)
{
/* The FSM is empty, so don't bother using it. */
int ti_options = TABLE_INSERT_SKIP_FSM;
uint32 ti_options = TABLE_INSERT_SKIP_FSM;
CommandId mycid;
EState *estate;
ListCell *listptr,

View file

@ -95,7 +95,7 @@
* ----------
*/
extern HeapTuple heap_toast_insert_or_update(Relation rel, HeapTuple newtup,
HeapTuple oldtup, int options);
HeapTuple oldtup, uint32 options);
/* ----------
* heap_toast_delete -

View file

@ -54,7 +54,7 @@ typedef struct BulkInsertStateData
extern void RelationPutHeapTuple(Relation relation, Buffer buffer,
HeapTuple tuple, bool token);
extern Buffer RelationGetBufferForTuple(Relation relation, Size len,
Buffer otherBuffer, int options,
Buffer otherBuffer, uint32 options,
BulkInsertStateData *bistate,
Buffer *vmbuffer, Buffer *vmbuffer_other,
int num_pages);

View file

@ -107,7 +107,7 @@ extern int toast_tuple_find_biggest_attribute(ToastTupleContext *ttc,
bool check_main);
extern void toast_tuple_try_compression(ToastTupleContext *ttc, int attribute);
extern void toast_tuple_externalize(ToastTupleContext *ttc, int attribute,
int options);
uint32 options);
extern void toast_tuple_cleanup(ToastTupleContext *ttc);
extern void toast_delete_external(Relation rel, const Datum *values, const bool *isnull,

View file

@ -50,7 +50,7 @@ extern Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock);
extern void toast_delete_datum(Relation rel, Datum value, bool is_speculative);
extern Datum toast_save_datum(Relation rel, Datum value,
varlena *oldexternal, int options);
varlena *oldexternal, uint32 options);
extern int toast_open_indexes(Relation toastrel,
LOCKMODE lock,