Skip to content

Commit 23382b0

Browse files
committed
Rename some function arguments for better clarity
Especially make sure that array arguments have plural names. Discussion: https://www.postgresql.org/message-id/flat/5ed89c69-f4e6-5dab-4003-63bde7460e5e%40eisentraut.org
1 parent 11af63f commit 23382b0

File tree

5 files changed

+95
-95
lines changed

5 files changed

+95
-95
lines changed

src/backend/catalog/index.c

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,17 @@ static bool relationHasPrimaryKey(Relation rel);
108108
static TupleDesc ConstructTupleDescriptor(Relation heapRelation,
109109
const IndexInfo *indexInfo,
110110
const List *indexColNames,
111-
Oid accessMethodObjectId,
112-
const Oid *collationObjectId,
113-
const Oid *classObjectId);
111+
Oid accessMethodId,
112+
const Oid *collationIds,
113+
const Oid *opclassIds);
114114
static void InitializeAttributeOids(Relation indexRelation,
115115
int numatts, Oid indexoid);
116116
static void AppendAttributeTuples(Relation indexRelation, const Datum *attopts);
117117
static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
118118
Oid parentIndexId,
119119
const IndexInfo *indexInfo,
120120
const Oid *collationOids,
121-
const Oid *classOids,
121+
const Oid *opclassOids,
122122
const int16 *coloptions,
123123
bool primary,
124124
bool isexclusion,
@@ -286,9 +286,9 @@ static TupleDesc
286286
ConstructTupleDescriptor(Relation heapRelation,
287287
const IndexInfo *indexInfo,
288288
const List *indexColNames,
289-
Oid accessMethodObjectId,
290-
const Oid *collationObjectId,
291-
const Oid *classObjectId)
289+
Oid accessMethodId,
290+
const Oid *collationIds,
291+
const Oid *opclassIds)
292292
{
293293
int numatts = indexInfo->ii_NumIndexAttrs;
294294
int numkeyatts = indexInfo->ii_NumIndexKeyAttrs;
@@ -301,7 +301,7 @@ ConstructTupleDescriptor(Relation heapRelation,
301301
int i;
302302

303303
/* We need access to the index AM's API struct */
304-
amroutine = GetIndexAmRoutineByAmId(accessMethodObjectId, false);
304+
amroutine = GetIndexAmRoutineByAmId(accessMethodId, false);
305305

306306
/* ... and to the table's tuple descriptor */
307307
heapTupDesc = RelationGetDescr(heapRelation);
@@ -330,7 +330,7 @@ ConstructTupleDescriptor(Relation heapRelation,
330330
to->attcacheoff = -1;
331331
to->attislocal = true;
332332
to->attcollation = (i < numkeyatts) ?
333-
collationObjectId[i] : InvalidOid;
333+
collationIds[i] : InvalidOid;
334334

335335
/*
336336
* Set the attribute name as specified by caller.
@@ -436,10 +436,10 @@ ConstructTupleDescriptor(Relation heapRelation,
436436

437437
if (i < indexInfo->ii_NumIndexKeyAttrs)
438438
{
439-
tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(classObjectId[i]));
439+
tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassIds[i]));
440440
if (!HeapTupleIsValid(tuple))
441441
elog(ERROR, "cache lookup failed for opclass %u",
442-
classObjectId[i]);
442+
opclassIds[i]);
443443
opclassTup = (Form_pg_opclass) GETSTRUCT(tuple);
444444
if (OidIsValid(opclassTup->opckeytype))
445445
keyType = opclassTup->opckeytype;
@@ -553,7 +553,7 @@ UpdateIndexRelation(Oid indexoid,
553553
Oid parentIndexId,
554554
const IndexInfo *indexInfo,
555555
const Oid *collationOids,
556-
const Oid *classOids,
556+
const Oid *opclassOids,
557557
const int16 *coloptions,
558558
bool primary,
559559
bool isexclusion,
@@ -581,7 +581,7 @@ UpdateIndexRelation(Oid indexoid,
581581
for (i = 0; i < indexInfo->ii_NumIndexAttrs; i++)
582582
indkey->values[i] = indexInfo->ii_IndexAttrNumbers[i];
583583
indcollation = buildoidvector(collationOids, indexInfo->ii_NumIndexKeyAttrs);
584-
indclass = buildoidvector(classOids, indexInfo->ii_NumIndexKeyAttrs);
584+
indclass = buildoidvector(opclassOids, indexInfo->ii_NumIndexKeyAttrs);
585585
indoption = buildint2vector(coloptions, indexInfo->ii_NumIndexKeyAttrs);
586586

587587
/*
@@ -679,10 +679,10 @@ UpdateIndexRelation(Oid indexoid,
679679
* May be nonzero to attach an existing valid build.
680680
* indexInfo: same info executor uses to insert into the index
681681
* indexColNames: column names to use for index (List of char *)
682-
* accessMethodObjectId: OID of index AM to use
682+
* accessMethodId: OID of index AM to use
683683
* tableSpaceId: OID of tablespace to use
684-
* collationObjectId: array of collation OIDs, one per index column
685-
* classObjectId: array of index opclass OIDs, one per index column
684+
* collationIds: array of collation OIDs, one per index column
685+
* opclassIds: array of index opclass OIDs, one per index column
686686
* coloptions: array of per-index-column indoption settings
687687
* reloptions: AM-specific options
688688
* flags: bitmask that can include any combination of these bits:
@@ -719,10 +719,10 @@ index_create(Relation heapRelation,
719719
RelFileNumber relFileNumber,
720720
IndexInfo *indexInfo,
721721
const List *indexColNames,
722-
Oid accessMethodObjectId,
722+
Oid accessMethodId,
723723
Oid tableSpaceId,
724-
const Oid *collationObjectId,
725-
const Oid *classObjectId,
724+
const Oid *collationIds,
725+
const Oid *opclassIds,
726726
const int16 *coloptions,
727727
Datum reloptions,
728728
bits16 flags,
@@ -806,8 +806,8 @@ index_create(Relation heapRelation,
806806
*/
807807
for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
808808
{
809-
Oid collation = collationObjectId[i];
810-
Oid opclass = classObjectId[i];
809+
Oid collation = collationIds[i];
810+
Oid opclass = opclassIds[i];
811811

812812
if (collation)
813813
{
@@ -908,9 +908,9 @@ index_create(Relation heapRelation,
908908
indexTupDesc = ConstructTupleDescriptor(heapRelation,
909909
indexInfo,
910910
indexColNames,
911-
accessMethodObjectId,
912-
collationObjectId,
913-
classObjectId);
911+
accessMethodId,
912+
collationIds,
913+
opclassIds);
914914

915915
/*
916916
* Allocate an OID for the index, unless we were told what to use.
@@ -964,7 +964,7 @@ index_create(Relation heapRelation,
964964
tableSpaceId,
965965
indexRelationId,
966966
relFileNumber,
967-
accessMethodObjectId,
967+
accessMethodId,
968968
indexTupDesc,
969969
relkind,
970970
relpersistence,
@@ -993,7 +993,7 @@ index_create(Relation heapRelation,
993993
* XXX should have a cleaner way to create cataloged indexes
994994
*/
995995
indexRelation->rd_rel->relowner = heapRelation->rd_rel->relowner;
996-
indexRelation->rd_rel->relam = accessMethodObjectId;
996+
indexRelation->rd_rel->relam = accessMethodId;
997997
indexRelation->rd_rel->relispartition = OidIsValid(parentIndexRelid);
998998

999999
/*
@@ -1030,7 +1030,7 @@ index_create(Relation heapRelation,
10301030
*/
10311031
UpdateIndexRelation(indexRelationId, heapRelationId, parentIndexRelid,
10321032
indexInfo,
1033-
collationObjectId, classObjectId, coloptions,
1033+
collationIds, opclassIds, coloptions,
10341034
isprimary, is_exclusion,
10351035
(constr_flags & INDEX_CONSTR_CREATE_DEFERRABLE) == 0,
10361036
!concurrent && !invalid,
@@ -1159,19 +1159,19 @@ index_create(Relation heapRelation,
11591159
/* The default collation is pinned, so don't bother recording it */
11601160
for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
11611161
{
1162-
if (OidIsValid(collationObjectId[i]) &&
1163-
collationObjectId[i] != DEFAULT_COLLATION_OID)
1162+
if (OidIsValid(collationIds[i]) &&
1163+
collationIds[i] != DEFAULT_COLLATION_OID)
11641164
{
11651165
ObjectAddressSet(referenced, CollationRelationId,
1166-
collationObjectId[i]);
1166+
collationIds[i]);
11671167
add_exact_object_address(&referenced, addrs);
11681168
}
11691169
}
11701170

11711171
/* Store dependency on operator classes */
11721172
for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
11731173
{
1174-
ObjectAddressSet(referenced, OperatorClassRelationId, classObjectId[i]);
1174+
ObjectAddressSet(referenced, OperatorClassRelationId, opclassIds[i]);
11751175
add_exact_object_address(&referenced, addrs);
11761176
}
11771177

src/backend/catalog/toasting.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
142142
char toast_relname[NAMEDATALEN];
143143
char toast_idxname[NAMEDATALEN];
144144
IndexInfo *indexInfo;
145-
Oid collationObjectId[2];
146-
Oid classObjectId[2];
145+
Oid collationIds[2];
146+
Oid opclassIds[2];
147147
int16 coloptions[2];
148148
ObjectAddress baseobject,
149149
toastobject;
@@ -312,11 +312,11 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
312312
indexInfo->ii_AmCache = NULL;
313313
indexInfo->ii_Context = CurrentMemoryContext;
314314

315-
collationObjectId[0] = InvalidOid;
316-
collationObjectId[1] = InvalidOid;
315+
collationIds[0] = InvalidOid;
316+
collationIds[1] = InvalidOid;
317317

318-
classObjectId[0] = OID_BTREE_OPS_OID;
319-
classObjectId[1] = INT4_BTREE_OPS_OID;
318+
opclassIds[0] = OID_BTREE_OPS_OID;
319+
opclassIds[1] = INT4_BTREE_OPS_OID;
320320

321321
coloptions[0] = 0;
322322
coloptions[1] = 0;
@@ -327,7 +327,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
327327
list_make2("chunk_id", "chunk_seq"),
328328
BTREE_AM_OID,
329329
rel->rd_rel->reltablespace,
330-
collationObjectId, classObjectId, coloptions, (Datum) 0,
330+
collationIds, opclassIds, coloptions, (Datum) 0,
331331
INDEX_CREATE_IS_PRIMARY, 0, true, true, NULL);
332332

333333
table_close(toast_rel, NoLock);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy