mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +03:00
Rename IndexInfo.ii_KeyAttrNumbers array
Rename ii_KeyAttrNumbers to ii_IndexAttrNumbers to prevent confusion with ii_NumIndexAttrs/ii_NumIndexKeyAttrs. ii_IndexAttrNumbers contains all attributes including "including" columns, not only key attribute. Discussion: https://www.postgresql.org/message-id/13123421-1d52-d0e4-c95c-6d69011e0595%40sigaev.ru
This commit is contained in:
@@ -239,7 +239,7 @@ index_check_primary_key(Relation heapRel,
|
||||
cmds = NIL;
|
||||
for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
|
||||
{
|
||||
AttrNumber attnum = indexInfo->ii_KeyAttrNumbers[i];
|
||||
AttrNumber attnum = indexInfo->ii_IndexAttrNumbers[i];
|
||||
HeapTuple atttuple;
|
||||
Form_pg_attribute attform;
|
||||
|
||||
@@ -324,7 +324,7 @@ ConstructTupleDescriptor(Relation heapRelation,
|
||||
*/
|
||||
for (i = 0; i < numatts; i++)
|
||||
{
|
||||
AttrNumber atnum = indexInfo->ii_KeyAttrNumbers[i];
|
||||
AttrNumber atnum = indexInfo->ii_IndexAttrNumbers[i];
|
||||
Form_pg_attribute to = TupleDescAttr(indexTupDesc, i);
|
||||
HeapTuple tuple;
|
||||
Form_pg_type typeTup;
|
||||
@@ -607,7 +607,7 @@ UpdateIndexRelation(Oid indexoid,
|
||||
*/
|
||||
indkey = buildint2vector(NULL, indexInfo->ii_NumIndexAttrs);
|
||||
for (i = 0; i < indexInfo->ii_NumIndexAttrs; i++)
|
||||
indkey->values[i] = indexInfo->ii_KeyAttrNumbers[i];
|
||||
indkey->values[i] = indexInfo->ii_IndexAttrNumbers[i];
|
||||
indcollation = buildoidvector(collationOids, indexInfo->ii_NumIndexAttrs);
|
||||
indclass = buildoidvector(classOids, indexInfo->ii_NumIndexKeyAttrs);
|
||||
indoption = buildint2vector(coloptions, indexInfo->ii_NumIndexAttrs);
|
||||
@@ -1041,11 +1041,11 @@ index_create(Relation heapRelation,
|
||||
/* Create auto dependencies on simply-referenced columns */
|
||||
for (i = 0; i < indexInfo->ii_NumIndexAttrs; i++)
|
||||
{
|
||||
if (indexInfo->ii_KeyAttrNumbers[i] != 0)
|
||||
if (indexInfo->ii_IndexAttrNumbers[i] != 0)
|
||||
{
|
||||
referenced.classId = RelationRelationId;
|
||||
referenced.objectId = heapRelationId;
|
||||
referenced.objectSubId = indexInfo->ii_KeyAttrNumbers[i];
|
||||
referenced.objectSubId = indexInfo->ii_IndexAttrNumbers[i];
|
||||
|
||||
recordDependencyOn(&myself, &referenced, deptype);
|
||||
|
||||
@@ -1297,7 +1297,7 @@ index_constraint_create(Relation heapRelation,
|
||||
true,
|
||||
parentConstraintId,
|
||||
RelationGetRelid(heapRelation),
|
||||
indexInfo->ii_KeyAttrNumbers,
|
||||
indexInfo->ii_IndexAttrNumbers,
|
||||
indexInfo->ii_NumIndexKeyAttrs,
|
||||
indexInfo->ii_NumIndexAttrs,
|
||||
InvalidOid, /* no domain */
|
||||
@@ -1757,7 +1757,7 @@ BuildIndexInfo(Relation index)
|
||||
Assert(ii->ii_NumIndexKeyAttrs <= ii->ii_NumIndexAttrs);
|
||||
|
||||
for (i = 0; i < numAtts; i++)
|
||||
ii->ii_KeyAttrNumbers[i] = indexStruct->indkey.values[i];
|
||||
ii->ii_IndexAttrNumbers[i] = indexStruct->indkey.values[i];
|
||||
|
||||
/* fetch any expressions needed for expressional indexes */
|
||||
ii->ii_Expressions = RelationGetIndexExpressions(index);
|
||||
@@ -1840,13 +1840,13 @@ CompareIndexInfo(IndexInfo *info1, IndexInfo *info2,
|
||||
*/
|
||||
for (i = 0; i < info1->ii_NumIndexAttrs; i++)
|
||||
{
|
||||
if (maplen < info2->ii_KeyAttrNumbers[i])
|
||||
if (maplen < info2->ii_IndexAttrNumbers[i])
|
||||
elog(ERROR, "incorrect attribute map");
|
||||
|
||||
/* ignore expressions at this stage */
|
||||
if ((info1->ii_KeyAttrNumbers[i] != InvalidAttrNumber) &&
|
||||
(attmap[info2->ii_KeyAttrNumbers[i] - 1] !=
|
||||
info1->ii_KeyAttrNumbers[i]))
|
||||
if ((info1->ii_IndexAttrNumbers[i] != InvalidAttrNumber) &&
|
||||
(attmap[info2->ii_IndexAttrNumbers[i] - 1] !=
|
||||
info1->ii_IndexAttrNumbers[i]))
|
||||
return false;
|
||||
|
||||
if (collations1[i] != collations2[i])
|
||||
@@ -2007,7 +2007,7 @@ FormIndexDatum(IndexInfo *indexInfo,
|
||||
|
||||
for (i = 0; i < indexInfo->ii_NumIndexAttrs; i++)
|
||||
{
|
||||
int keycol = indexInfo->ii_KeyAttrNumbers[i];
|
||||
int keycol = indexInfo->ii_IndexAttrNumbers[i];
|
||||
Datum iDatum;
|
||||
bool isNull;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user