Skip to content

Commit b57cfb4

Browse files
committed
Document RelationGetIndexAttrBitmap better
Commit 19d8e23 changed the list of set-of-columns that can be returned by RelationGetIndexAttrBitmap, but didn't update its "documentation". That was pretty hard to read already, so rewrite to make it more comprehensible, adding the missing values while at it. Backpatch to 16, like that commit. Discussion: https://postgr.es/m/20230809091155.7c7f3gttjk3dj4ze@alvherre.pgsql Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>
1 parent 4d14ccd commit b57cfb4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/backend/utils/cache/relcache.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5150,9 +5150,15 @@ RelationGetIndexPredicate(Relation relation)
51505150
* simple index keys, but attributes used in expressions and partial-index
51515151
* predicates.)
51525152
*
5153-
* Depending on attrKind, a bitmap covering the attnums for all index columns,
5154-
* for all potential foreign key columns, or for all columns in the configured
5155-
* replica identity index is returned.
5153+
* Depending on attrKind, a bitmap covering attnums for certain columns is
5154+
* returned:
5155+
* INDEX_ATTR_BITMAP_KEY Columns in non-partial unique indexes not
5156+
* in expressions (i.e., usable for FKs)
5157+
* INDEX_ATTR_BITMAP_PRIMARY_KEY Columns in the table's primary key
5158+
* INDEX_ATTR_BITMAP_IDENTITY_KEY Columns in the table's replica identity
5159+
* index (empty if FULL)
5160+
* INDEX_ATTR_BITMAP_HOT_BLOCKING Columns that block updates from being HOT
5161+
* INDEX_ATTR_BITMAP_SUMMARIZED Columns included in summarizing indexes
51565162
*
51575163
* Attribute numbers are offset by FirstLowInvalidHeapAttributeNumber so that
51585164
* we can include system attributes (e.g., OID) in the bitmap representation.

src/include/utils/relcache.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ extern List *RelationGetIndexPredicate(Relation relation);
5454
extern Datum *RelationGetIndexRawAttOptions(Relation indexrel);
5555
extern bytea **RelationGetIndexAttOptions(Relation relation, bool copy);
5656

57+
/*
58+
* Which set of columns to return by RelationGetIndexAttrBitmap.
59+
*/
5760
typedef enum IndexAttrBitmapKind
5861
{
5962
INDEX_ATTR_BITMAP_KEY,

0 commit comments

Comments
 (0)