MCPcopy Create free account
hub / github.com/documentdb/documentdb / IndexKeyGetMatchingIndexes

Function IndexKeyGetMatchingIndexes

pg_documentdb/src/metadata/index.c:1108–1122  ·  view source on GitHub ↗

* IndexKeyGetMatchingIndexes returns a list of IndexDetails objects for the * valid indexes with given "key" using SPI. * * Returns indexes in the order of their ids. */

Source from the content-addressed store, hash-verified

1106 * Returns indexes in the order of their ids.
1107 */
1108List *
1109IndexKeyGetMatchingIndexes(uint64 collectionId, const pgbson *indexKeyDocument)
1110{
1111 const char *cmdStr =
1112 FormatSqlQuery(
1113 "SELECT array_agg(index_id ORDER BY index_id), array_agg(index_spec ORDER BY index_id), "
1114 " array_agg(%s.index_build_is_in_progress(index_id) ORDER BY index_id) "
1115 "FROM %s.collection_indexes WHERE collection_id = $1 AND"
1116 " (index_spec).index_key::%s OPERATOR(%s.=) $2::%s AND"
1117 " (index_is_valid OR %s.index_build_is_in_progress(index_id))",
1118 ApiInternalSchemaName, ApiCatalogSchemaName, FullBsonTypeName, CoreSchemaName,
1119 FullBsonTypeName, ApiInternalSchemaName);
1120
1121 return IndexKeyGetMatchingIndexesCore(cmdStr, collectionId, indexKeyDocument);
1122}
1123
1124
1125/*

Callers 1

Calls 2

FormatSqlQueryFunction · 0.85

Tested by

no test coverage detected