* Given a collection and index key, returns the index details for the index * if it is ready to be used. If the index is not ready, returns NULL. */
| 1085 | * if it is ready to be used. If the index is not ready, returns NULL. |
| 1086 | */ |
| 1087 | List * |
| 1088 | IndexKeyGetReadyMatchingIndexes(uint64 collectionId, const pgbson *indexKeyDocument) |
| 1089 | { |
| 1090 | const char *cmdStr = |
| 1091 | FormatSqlQuery( |
| 1092 | "SELECT array_agg(index_id ORDER BY index_id), array_agg(index_spec ORDER BY index_id), " |
| 1093 | " array_agg(NOT(index_is_valid) ORDER BY index_id) " |
| 1094 | "FROM %s.collection_indexes WHERE collection_id = $1 AND" |
| 1095 | " (index_spec).index_key::%s OPERATOR(%s.=) $2::%s AND index_is_valid", |
| 1096 | ApiCatalogSchemaName, FullBsonTypeName, CoreSchemaName, |
| 1097 | FullBsonTypeName); |
| 1098 | return IndexKeyGetMatchingIndexesCore(cmdStr, collectionId, indexKeyDocument); |
| 1099 | } |
| 1100 | |
| 1101 | |
| 1102 | /* |
no test coverage detected