| 1507 | |
| 1508 | |
| 1509 | bool |
| 1510 | RumGetTruncationStatus(Relation indexRelation) |
| 1511 | { |
| 1512 | EnsureRumLibLoaded(); |
| 1513 | |
| 1514 | if (!IsCompositeOpClass(indexRelation)) |
| 1515 | { |
| 1516 | return false; |
| 1517 | } |
| 1518 | |
| 1519 | /* Start a nested query lookup */ |
| 1520 | IndexScanDesc innerDesc = rum_index_routine.ambeginscan(indexRelation, 1, 0); |
| 1521 | |
| 1522 | ScanKeyData truncatedKey = { 0 }; |
| 1523 | truncatedKey.sk_attno = 1; |
| 1524 | truncatedKey.sk_collation = InvalidOid; |
| 1525 | truncatedKey.sk_strategy = BSON_INDEX_STRATEGY_HAS_TRUNCATED_TERMS; |
| 1526 | truncatedKey.sk_argument = PointerGetDatum(PgbsonInitEmpty()); |
| 1527 | innerDesc->parallel_scan = NULL; |
| 1528 | |
| 1529 | rum_index_routine.amrescan(innerDesc, &truncatedKey, 1, NULL, 0); |
| 1530 | bool hasTruncation = rum_index_routine.amgettuple(innerDesc, ForwardScanDirection); |
| 1531 | rum_index_routine.amendscan(innerDesc); |
| 1532 | return hasTruncation; |
| 1533 | } |
| 1534 | |
| 1535 | |
| 1536 | static List * |
no test coverage detected