* IndexKeyGetMatchingIndexes returns a list of IndexDetails objects for the * valid indexes with given "key" using SPI. * * Returns indexes in the order of their ids. */
| 1106 | * Returns indexes in the order of their ids. |
| 1107 | */ |
| 1108 | List * |
| 1109 | IndexKeyGetMatchingIndexes(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 | /* |
no test coverage detected