Introduce ColumnarSupportsIndexAM

pull/5103/head
Onur Tirtir 2021-07-09 17:04:39 +03:00
parent d140ca1b0e
commit eeecbd2324
2 changed files with 14 additions and 3 deletions

View File

@ -1863,9 +1863,7 @@ ColumnarProcessUtility(PlannedStmt *pstmt,
GetCreateIndexRelationLockMode(indexStmt));
if (rel->rd_tableam == GetColumnarTableAmRoutine())
{
/* for now, we don't support index access methods other than btree & hash */
if (strncmp(indexStmt->accessMethod, "btree", NAMEDATALEN) != 0 &&
strncmp(indexStmt->accessMethod, "hash", NAMEDATALEN) != 0)
if (!ColumnarSupportsIndexAM(indexStmt->accessMethod))
{
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only btree and hash indexes are supported on "
@ -1881,6 +1879,18 @@ ColumnarProcessUtility(PlannedStmt *pstmt,
}
/*
* ColumnarSupportsIndexAM returns true if indexAM with given name is
* supported by columnar tables.
*/
bool
ColumnarSupportsIndexAM(char *indexAMName)
{
return strncmp(indexAMName, "btree", NAMEDATALEN) == 0 ||
strncmp(indexAMName, "hash", NAMEDATALEN) == 0;
}
/*
* IsColumnarTableAmTable returns true if relation has columnar_tableam
* access method. This can be called before extension creation.

View File

@ -52,6 +52,7 @@ extern TableScanDesc columnar_beginscan_extended(Relation relation, Snapshot sna
uint32 flags, Bitmapset *attr_needed,
List *scanQual);
extern int64 ColumnarScanChunkGroupsFiltered(TableScanDesc scanDesc);
extern bool ColumnarSupportsIndexAM(char *indexAMName);
extern bool IsColumnarTableAmTable(Oid relationId);
extern TableDDLCommand * ColumnarGetTableOptionsDDL(Oid relationId);
extern char * GetShardedTableDDLCommandColumnar(uint64 shardId, void *context);