| 1467 | |
| 1468 | |
| 1469 | static bool |
| 1470 | CheckIndexHasReducedTerms(Relation indexRelation, IndexAmRoutine *coreRoutine) |
| 1471 | { |
| 1472 | /* Start a nested query lookup */ |
| 1473 | IndexScanDesc innerDesc = coreRoutine->ambeginscan(indexRelation, 1, 0); |
| 1474 | |
| 1475 | ScanKeyData arrayKey = { 0 }; |
| 1476 | arrayKey.sk_attno = 1; |
| 1477 | arrayKey.sk_collation = InvalidOid; |
| 1478 | arrayKey.sk_strategy = BSON_INDEX_STRATEGY_HAS_CORRELATED_REDUCED_TERMS; |
| 1479 | arrayKey.sk_argument = PointerGetDatum(PgbsonInitEmpty()); |
| 1480 | |
| 1481 | innerDesc->parallel_scan = NULL; |
| 1482 | coreRoutine->amrescan(innerDesc, &arrayKey, 1, NULL, 0); |
| 1483 | bool hasReducedArrayTerms = coreRoutine->amgettuple(innerDesc, ForwardScanDirection); |
| 1484 | coreRoutine->amendscan(innerDesc); |
| 1485 | return hasReducedArrayTerms; |
| 1486 | } |
| 1487 | |
| 1488 | |
| 1489 | static IndexMultiKeyStatus |
no test coverage detected