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

Commit ee3fdb8

Browse files
author
Amit Kapila
committed
Improve RelationGetIdentityKeyBitmap().
We were using RelationGetIndexList() to update the relation's replica identity index but instead, we can directly use RelationGetReplicaIndex() which uses the same functionality. This is a minor code readability improvement. Author: Japin Li Reviewed-By: Takamichi Osumi, Amit Kapila Discussion: https://postgr.es/m/4C99A862-69C8-431F-960A-81B1151F1B89@enterprisedb.com
1 parent b786304 commit ee3fdb8

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/backend/utils/cache/relcache.c

+4-9
Original file line numberDiff line numberDiff line change
@@ -5244,9 +5244,9 @@ Bitmapset *
52445244
RelationGetIdentityKeyBitmap(Relation relation)
52455245
{
52465246
Bitmapset *idindexattrs = NULL; /* columns in the replica identity */
5247-
List *indexoidlist;
52485247
Relation indexDesc;
52495248
int i;
5249+
Oid replidindex;
52505250
MemoryContext oldcxt;
52515251

52525252
/* Quick exit if we already computed the result */
@@ -5260,18 +5260,14 @@ RelationGetIdentityKeyBitmap(Relation relation)
52605260
/* Historic snapshot must be set. */
52615261
Assert(HistoricSnapshotActive());
52625262

5263-
indexoidlist = RelationGetIndexList(relation);
5264-
5265-
/* Fall out if no indexes (but relhasindex was set) */
5266-
if (indexoidlist == NIL)
5267-
return NULL;
5263+
replidindex = RelationGetReplicaIndex(relation);
52685264

52695265
/* Fall out if there is no replica identity index */
5270-
if (!OidIsValid(relation->rd_replidindex))
5266+
if (!OidIsValid(replidindex))
52715267
return NULL;
52725268

52735269
/* Look up the description for the replica identity index */
5274-
indexDesc = RelationIdGetRelation(relation->rd_replidindex);
5270+
indexDesc = RelationIdGetRelation(replidindex);
52755271

52765272
if (!RelationIsValid(indexDesc))
52775273
elog(ERROR, "could not open relation with OID %u",
@@ -5295,7 +5291,6 @@ RelationGetIdentityKeyBitmap(Relation relation)
52955291
}
52965292

52975293
RelationClose(indexDesc);
5298-
list_free(indexoidlist);
52995294

53005295
/* Don't leak the old values of these bitmaps, if any */
53015296
bms_free(relation->rd_idattr);

0 commit comments

Comments
 (0)