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

Function IsCompositeOpClass

pg_documentdb/src/index_am/index_am_utils.c:382–406  ·  view source on GitHub ↗

* Whether the index relation was created via a composite index opclass */

Source from the content-addressed store, hash-verified

380 * Whether the index relation was created via a composite index opclass
381 */
382bool
383IsCompositeOpClass(Relation indexRelation)
384{
385 const BsonIndexAmEntry *amEntry = GetBsonIndexAmEntryByIndexOid(
386 indexRelation->rd_rel->relam);
387 if (amEntry == NULL)
388 {
389 return false;
390 }
391
392 /* Non unique indexes will have 1 attribute that has the entire composite key
393 * Unique indexes will have the first attribute matching non-unique indexes, and the
394 * second attribute matching the unique constraint key.
395 * We put the composite column first just for convenience, so we can keep the order by
396 * and query paths the same between the two.
397 */
398 if (IndexRelationGetNumberOfKeyAttributes(indexRelation) == 1 ||
399 IndexRelationGetNumberOfKeyAttributes(indexRelation) == 2)
400 {
401 return indexRelation->rd_opfamily[0] ==
402 amEntry->get_composite_path_op_family_oid();
403 }
404
405 return false;
406}
407
408
409bool

Callers 12

extension_rumbuild_coreFunction · 0.85
RumGetTruncationStatusFunction · 0.85
ExplainCompositeScanFunction · 0.85
ExplainIndexScanStateFunction · 0.85
AddPathStringToHashsetFunction · 0.85
LogIndexScanDetailsFunction · 0.85
WriteIndexExecutionStatsFunction · 0.85

Calls 1

Tested by

no test coverage detected