Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1d91d24

Browse files
committed
Add const to values and nulls arguments
This excludes any changes that would change the external AM APIs. Reviewed-by: Aleksander Alekseev <aleksander@timescale.com> Discussion: https://www.postgresql.org/message-id/flat/14c31f4a-0347-0805-dce8-93a9072c05a5%40eisentraut.org
1 parent fc4089f commit 1d91d24

File tree

28 files changed

+83
-83
lines changed

28 files changed

+83
-83
lines changed

src/backend/access/brin/brin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void union_tuples(BrinDesc *bdesc, BrinMemTuple *a,
8080
BrinTuple *b);
8181
static void brin_vacuum_scan(Relation idxrel, BufferAccessStrategy strategy);
8282
static bool add_values_to_range(Relation idxRel, BrinDesc *bdesc,
83-
BrinMemTuple *dtup, Datum *values, bool *nulls);
83+
BrinMemTuple *dtup, const Datum *values, const bool *nulls);
8484
static bool check_null_keys(BrinValues *bval, ScanKey *nullkeys, int nnullkeys);
8585

8686
/*
@@ -1774,7 +1774,7 @@ brin_vacuum_scan(Relation idxrel, BufferAccessStrategy strategy)
17741774

17751775
static bool
17761776
add_values_to_range(Relation idxRel, BrinDesc *bdesc, BrinMemTuple *dtup,
1777-
Datum *values, bool *nulls)
1777+
const Datum *values, const bool *nulls)
17781778
{
17791779
int keyno;
17801780

src/backend/access/common/heaptuple.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ getmissingattr(TupleDesc tupleDesc,
205205
*/
206206
Size
207207
heap_compute_data_size(TupleDesc tupleDesc,
208-
Datum *values,
209-
bool *isnull)
208+
const Datum *values,
209+
const bool *isnull)
210210
{
211211
Size data_length = 0;
212212
int i;
@@ -390,7 +390,7 @@ fill_val(Form_pg_attribute att,
390390
*/
391391
void
392392
heap_fill_tuple(TupleDesc tupleDesc,
393-
Datum *values, bool *isnull,
393+
const Datum *values, const bool *isnull,
394394
char *data, Size data_size,
395395
uint16 *infomask, bits8 *bit)
396396
{
@@ -1106,8 +1106,8 @@ heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)
11061106
*/
11071107
HeapTuple
11081108
heap_form_tuple(TupleDesc tupleDescriptor,
1109-
Datum *values,
1110-
bool *isnull)
1109+
const Datum *values,
1110+
const bool *isnull)
11111111
{
11121112
HeapTuple tuple; /* return tuple */
11131113
HeapTupleHeader td; /* tuple data */
@@ -1200,9 +1200,9 @@ heap_form_tuple(TupleDesc tupleDescriptor,
12001200
HeapTuple
12011201
heap_modify_tuple(HeapTuple tuple,
12021202
TupleDesc tupleDesc,
1203-
Datum *replValues,
1204-
bool *replIsnull,
1205-
bool *doReplace)
1203+
const Datum *replValues,
1204+
const bool *replIsnull,
1205+
const bool *doReplace)
12061206
{
12071207
int numberOfAttributes = tupleDesc->natts;
12081208
int attoff;
@@ -1269,9 +1269,9 @@ HeapTuple
12691269
heap_modify_tuple_by_cols(HeapTuple tuple,
12701270
TupleDesc tupleDesc,
12711271
int nCols,
1272-
int *replCols,
1273-
Datum *replValues,
1274-
bool *replIsnull)
1272+
const int *replCols,
1273+
const Datum *replValues,
1274+
const bool *replIsnull)
12751275
{
12761276
int numberOfAttributes = tupleDesc->natts;
12771277
Datum *values;
@@ -1442,8 +1442,8 @@ heap_freetuple(HeapTuple htup)
14421442
*/
14431443
MinimalTuple
14441444
heap_form_minimal_tuple(TupleDesc tupleDescriptor,
1445-
Datum *values,
1446-
bool *isnull)
1445+
const Datum *values,
1446+
const bool *isnull)
14471447
{
14481448
MinimalTuple tuple; /* return tuple */
14491449
Size len,

src/backend/access/common/indextuple.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
*/
4343
IndexTuple
4444
index_form_tuple(TupleDesc tupleDescriptor,
45-
Datum *values,
46-
bool *isnull)
45+
const Datum *values,
46+
const bool *isnull)
4747
{
4848
return index_form_tuple_context(tupleDescriptor, values, isnull,
4949
CurrentMemoryContext);
@@ -63,8 +63,8 @@ index_form_tuple(TupleDesc tupleDescriptor,
6363
*/
6464
IndexTuple
6565
index_form_tuple_context(TupleDesc tupleDescriptor,
66-
Datum *values,
67-
bool *isnull,
66+
const Datum *values,
67+
const bool *isnull,
6868
MemoryContext context)
6969
{
7070
char *tp; /* tuple pointer */
@@ -79,8 +79,8 @@ index_form_tuple_context(TupleDesc tupleDescriptor,
7979
int numberOfAttributes = tupleDescriptor->natts;
8080

8181
#ifdef TOAST_INDEX_HACK
82-
Datum untoasted_values[INDEX_MAX_KEYS];
83-
bool untoasted_free[INDEX_MAX_KEYS];
82+
Datum untoasted_values[INDEX_MAX_KEYS] = {0};
83+
bool untoasted_free[INDEX_MAX_KEYS] = {0};
8484
#endif
8585

8686
if (numberOfAttributes > INDEX_MAX_KEYS)

src/backend/access/gist/gistutil.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
573573

574574
IndexTuple
575575
gistFormTuple(GISTSTATE *giststate, Relation r,
576-
Datum *attdata, bool *isnull, bool isleaf)
576+
const Datum *attdata, const bool *isnull, bool isleaf)
577577
{
578578
Datum compatt[INDEX_MAX_KEYS];
579579
IndexTuple res;
@@ -594,7 +594,7 @@ gistFormTuple(GISTSTATE *giststate, Relation r,
594594

595595
void
596596
gistCompressValues(GISTSTATE *giststate, Relation r,
597-
Datum *attdata, bool *isnull, bool isleaf, Datum *compatt)
597+
const Datum *attdata, const bool *isnull, bool isleaf, Datum *compatt)
598598
{
599599
int i;
600600

src/backend/access/hash/hashsort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ _h_spooldestroy(HSpool *hspool)
106106
* spool an index entry into the sort file.
107107
*/
108108
void
109-
_h_spool(HSpool *hspool, ItemPointer self, Datum *values, bool *isnull)
109+
_h_spool(HSpool *hspool, ItemPointer self, const Datum *values, const bool *isnull)
110110
{
111111
tuplesort_putindextuplevalues(hspool->sortstate, hspool->index,
112112
self, values, isnull);

src/backend/access/index/genam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ IndexScanEnd(IndexScanDesc scan)
175175
*/
176176
char *
177177
BuildIndexValueDescription(Relation indexRelation,
178-
Datum *values, bool *isnull)
178+
const Datum *values, const bool *isnull)
179179
{
180180
StringInfoData buf;
181181
Form_pg_index idxrec;

src/backend/access/spgist/spgutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ memcpyInnerDatum(void *target, SpGistTypeDesc *att, Datum datum)
788788
*/
789789
Size
790790
SpGistGetLeafTupleSize(TupleDesc tupleDescriptor,
791-
Datum *datums, bool *isnulls)
791+
const Datum *datums, const bool *isnulls)
792792
{
793793
Size size;
794794
Size data_size;
@@ -841,7 +841,7 @@ SpGistGetLeafTupleSize(TupleDesc tupleDescriptor,
841841
*/
842842
SpGistLeafTuple
843843
spgFormLeafTuple(SpGistState *state, ItemPointer heapPtr,
844-
Datum *datums, bool *isnulls)
844+
const Datum *datums, const bool *isnulls)
845845
{
846846
SpGistLeafTuple tup;
847847
TupleDesc tupleDescriptor = state->leafTupDesc;

src/backend/access/table/toast_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ toast_tuple_cleanup(ToastTupleContext *ttc)
316316
* relation.
317317
*/
318318
void
319-
toast_delete_external(Relation rel, Datum *values, bool *isnull,
319+
toast_delete_external(Relation rel, const Datum *values, const bool *isnull,
320320
bool is_speculative)
321321
{
322322
TupleDesc tupleDesc = rel->rd_att;

src/backend/executor/execIndexing.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ typedef enum
127127
static bool check_exclusion_or_unique_constraint(Relation heap, Relation index,
128128
IndexInfo *indexInfo,
129129
ItemPointer tupleid,
130-
Datum *values, bool *isnull,
130+
const Datum *values, const bool *isnull,
131131
EState *estate, bool newIndex,
132132
CEOUC_WAIT_MODE waitMode,
133133
bool violationOK,
134134
ItemPointer conflictTid);
135135

136-
static bool index_recheck_constraint(Relation index, Oid *constr_procs,
137-
Datum *existing_values, bool *existing_isnull,
138-
Datum *new_values);
136+
static bool index_recheck_constraint(Relation index, const Oid *constr_procs,
137+
const Datum *existing_values, const bool *existing_isnull,
138+
const Datum *new_values);
139139
static bool index_unchanged_by_update(ResultRelInfo *resultRelInfo,
140140
EState *estate, IndexInfo *indexInfo,
141141
Relation indexRelation);
@@ -684,7 +684,7 @@ static bool
684684
check_exclusion_or_unique_constraint(Relation heap, Relation index,
685685
IndexInfo *indexInfo,
686686
ItemPointer tupleid,
687-
Datum *values, bool *isnull,
687+
const Datum *values, const bool *isnull,
688688
EState *estate, bool newIndex,
689689
CEOUC_WAIT_MODE waitMode,
690690
bool violationOK,
@@ -910,7 +910,7 @@ void
910910
check_exclusion_constraint(Relation heap, Relation index,
911911
IndexInfo *indexInfo,
912912
ItemPointer tupleid,
913-
Datum *values, bool *isnull,
913+
const Datum *values, const bool *isnull,
914914
EState *estate, bool newIndex)
915915
{
916916
(void) check_exclusion_or_unique_constraint(heap, index, indexInfo, tupleid,
@@ -924,9 +924,9 @@ check_exclusion_constraint(Relation heap, Relation index,
924924
* exclusion condition against the new_values. Returns true if conflict.
925925
*/
926926
static bool
927-
index_recheck_constraint(Relation index, Oid *constr_procs,
928-
Datum *existing_values, bool *existing_isnull,
929-
Datum *new_values)
927+
index_recheck_constraint(Relation index, const Oid *constr_procs,
928+
const Datum *existing_values, const bool *existing_isnull,
929+
const Datum *new_values)
930930
{
931931
int indnkeyatts = IndexRelationGetNumberOfKeyAttributes(index);
932932
int i;

src/backend/executor/execTuples.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2273,7 +2273,7 @@ begin_tup_output_tupdesc(DestReceiver *dest,
22732273
* write a single tuple
22742274
*/
22752275
void
2276-
do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull)
2276+
do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull)
22772277
{
22782278
TupleTableSlot *slot = tstate->slot;
22792279
int natts = slot->tts_tupleDescriptor->natts;

src/backend/partitioning/partbounds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4720,8 +4720,8 @@ get_range_nulltest(PartitionKey key)
47204720
* Compute the hash value for given partition key values.
47214721
*/
47224722
uint64
4723-
compute_partition_hash_value(int partnatts, FmgrInfo *partsupfunc, Oid *partcollation,
4724-
Datum *values, bool *isnull)
4723+
compute_partition_hash_value(int partnatts, FmgrInfo *partsupfunc, const Oid *partcollation,
4724+
const Datum *values, const bool *isnull)
47254725
{
47264726
int i;
47274727
uint64 rowHash = 0;

src/backend/utils/adt/json.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ catenate_stringinfo_string(StringInfo buffer, const char *addon)
11821182
}
11831183

11841184
Datum
1185-
json_build_object_worker(int nargs, Datum *args, bool *nulls, Oid *types,
1185+
json_build_object_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types,
11861186
bool absent_on_null, bool unique_keys)
11871187
{
11881188
int i;
@@ -1295,7 +1295,7 @@ json_build_object_noargs(PG_FUNCTION_ARGS)
12951295
}
12961296

12971297
Datum
1298-
json_build_array_worker(int nargs, Datum *args, bool *nulls, Oid *types,
1298+
json_build_array_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types,
12991299
bool absent_on_null)
13001300
{
13011301
int i;

src/backend/utils/adt/jsonb.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void jsonb_put_escaped_value(StringInfo out, JsonbValue *scalarVal);
5858
static JsonParseErrorType jsonb_in_scalar(void *pstate, char *token, JsonTokenType tokentype);
5959
static void composite_to_jsonb(Datum composite, JsonbInState *result);
6060
static void array_dim_to_jsonb(JsonbInState *result, int dim, int ndims, int *dims,
61-
Datum *vals, bool *nulls, int *valcount,
61+
const Datum *vals, const bool *nulls, int *valcount,
6262
JsonTypeCategory tcategory, Oid outfuncoid);
6363
static void array_to_jsonb_internal(Datum array, JsonbInState *result);
6464
static void datum_to_jsonb_internal(Datum val, bool is_null, JsonbInState *result,
@@ -864,8 +864,8 @@ datum_to_jsonb_internal(Datum val, bool is_null, JsonbInState *result,
864864
* ourselves recursively to process the next dimension.
865865
*/
866866
static void
867-
array_dim_to_jsonb(JsonbInState *result, int dim, int ndims, int *dims, Datum *vals,
868-
bool *nulls, int *valcount, JsonTypeCategory tcategory,
867+
array_dim_to_jsonb(JsonbInState *result, int dim, int ndims, int *dims, const Datum *vals,
868+
const bool *nulls, int *valcount, JsonTypeCategory tcategory,
869869
Oid outfuncoid)
870870
{
871871
int i;
@@ -1127,7 +1127,7 @@ datum_to_jsonb(Datum val, JsonTypeCategory tcategory, Oid outfuncoid)
11271127
}
11281128

11291129
Datum
1130-
jsonb_build_object_worker(int nargs, Datum *args, bool *nulls, Oid *types,
1130+
jsonb_build_object_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types,
11311131
bool absent_on_null, bool unique_keys)
11321132
{
11331133
int i;
@@ -1212,7 +1212,7 @@ jsonb_build_object_noargs(PG_FUNCTION_ARGS)
12121212
}
12131213

12141214
Datum
1215-
jsonb_build_array_worker(int nargs, Datum *args, bool *nulls, Oid *types,
1215+
jsonb_build_array_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types,
12161216
bool absent_on_null)
12171217
{
12181218
int i;

src/backend/utils/sort/tuplesortvariants.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@ tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup)
683683
*/
684684
void
685685
tuplesort_putindextuplevalues(Tuplesortstate *state, Relation rel,
686-
ItemPointer self, Datum *values,
687-
bool *isnull)
686+
ItemPointer self, const Datum *values,
687+
const bool *isnull)
688688
{
689689
SortTuple stup;
690690
IndexTuple tuple;

src/backend/utils/sort/tuplestore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ tuplestore_puttuple(Tuplestorestate *state, HeapTuple tuple)
748748
*/
749749
void
750750
tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc,
751-
Datum *values, bool *isnull)
751+
const Datum *values, const bool *isnull)
752752
{
753753
MinimalTuple tuple;
754754
MemoryContext oldcxt = MemoryContextSwitchTo(state->context);

src/include/access/genam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ extern IndexScanDesc RelationGetIndexScan(Relation indexRelation,
204204
int nkeys, int norderbys);
205205
extern void IndexScanEnd(IndexScanDesc scan);
206206
extern char *BuildIndexValueDescription(Relation indexRelation,
207-
Datum *values, bool *isnull);
207+
const Datum *values, const bool *isnull);
208208
extern TransactionId index_compute_xid_horizon_for_tuples(Relation irel,
209209
Relation hrel,
210210
Buffer ibuf,

src/include/access/gist_private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ extern IndexTuple gistgetadjusted(Relation r,
502502
IndexTuple addtup,
503503
GISTSTATE *giststate);
504504
extern IndexTuple gistFormTuple(GISTSTATE *giststate,
505-
Relation r, Datum *attdata, bool *isnull, bool isleaf);
505+
Relation r, const Datum *attdata, const bool *isnull, bool isleaf);
506506
extern void gistCompressValues(GISTSTATE *giststate, Relation r,
507-
Datum *attdata, bool *isnull, bool isleaf, Datum *compatt);
507+
const Datum *attdata, const bool *isnull, bool isleaf, Datum *compatt);
508508

509509
extern OffsetNumber gistchoose(Relation r, Page p,
510510
IndexTuple it,

src/include/access/hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ typedef struct HSpool HSpool; /* opaque struct in hashsort.c */
451451
extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets);
452452
extern void _h_spooldestroy(HSpool *hspool);
453453
extern void _h_spool(HSpool *hspool, ItemPointer self,
454-
Datum *values, bool *isnull);
454+
const Datum *values, const bool *isnull);
455455
extern void _h_indexbuild(HSpool *hspool, Relation heapRel);
456456

457457
/* hashutil.c */

0 commit comments

Comments
 (0)