Skip to content

Commit 1b611bb

Browse files
committed
Update IndexAMProperty API to sync with YB additions to IndexAmRoutine
- Add YB properties to IndexAMProperty enum: - AMPROP_YB_IS_FOR_YB_RELATION - AMPROP_YB_IS_COPARTITIONED - AMPROP_YB_CAN_UPDATE_TUPLE_INPLACE - Add corresponding property names to am_propnames array - Add property handling logic in indexam_property function - Enable pg_indexam_has_property, pg_index_has_property, and pg_index_column_has_property functions to access YB properties Fixes #22246
1 parent d3bc257 commit 1b611bb

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/postgres/src/backend/utils/adt/amutils.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ static const struct am_propname am_propnames[] =
8484
{
8585
"can_include", AMPROP_CAN_INCLUDE
8686
},
87+
/* YB properties */
88+
{
89+
"yb_is_for_yb_relation", AMPROP_YB_IS_FOR_YB_RELATION
90+
},
91+
{
92+
"yb_is_copartitioned", AMPROP_YB_IS_COPARTITIONED
93+
},
94+
{
95+
"yb_can_update_tuple_inplace", AMPROP_YB_CAN_UPDATE_TUPLE_INPLACE
96+
},
8797
};
8898

8999
static IndexAMProperty
@@ -400,6 +410,16 @@ indexam_property(FunctionCallInfo fcinfo,
400410
case AMPROP_CAN_INCLUDE:
401411
PG_RETURN_BOOL(routine->amcaninclude);
402412

413+
/* YB properties */
414+
case AMPROP_YB_IS_FOR_YB_RELATION:
415+
PG_RETURN_BOOL(routine->yb_amisforybrelation);
416+
417+
case AMPROP_YB_IS_COPARTITIONED:
418+
PG_RETURN_BOOL(routine->yb_amiscopartitioned);
419+
420+
case AMPROP_YB_CAN_UPDATE_TUPLE_INPLACE:
421+
PG_RETURN_BOOL(routine->ybamcanupdatetupleinplace);
422+
403423
default:
404424
PG_RETURN_NULL();
405425
}

src/postgres/src/include/access/amapi.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ typedef enum IndexAMProperty
5757
AMPROP_CAN_UNIQUE,
5858
AMPROP_CAN_MULTI_COL,
5959
AMPROP_CAN_EXCLUDE,
60-
AMPROP_CAN_INCLUDE
60+
AMPROP_CAN_INCLUDE,
61+
/* YB properties */
62+
AMPROP_YB_IS_FOR_YB_RELATION, /* is AM for YB relations? */
63+
AMPROP_YB_IS_COPARTITIONED, /* is AM for YB copartitioned index? */
64+
AMPROP_YB_CAN_UPDATE_TUPLE_INPLACE /* does AM support in-place update? */
6165
} IndexAMProperty;
6266

6367
/*

0 commit comments

Comments
 (0)