* IndexSupportInitialize * Initializes an index's cached opclass information, * given the index's pg_index.indclass entry. * * Data is returned into *indexSupport, *opFamily, and *opcInType, * which are arrays allocated by the caller. * * The caller also passes maxSupportNumber and maxAttributeNumber, since these * indicate the size of the arrays it has allocated --- but in practice thes
| 1639 | * for the index and access method. |
| 1640 | */ |
| 1641 | static void |
| 1642 | IndexSupportInitialize(oidvector *indclass, |
| 1643 | RegProcedure *indexSupport, |
| 1644 | Oid *opFamily, |
| 1645 | Oid *opcInType, |
| 1646 | StrategyNumber maxSupportNumber, |
| 1647 | AttrNumber maxAttributeNumber) |
| 1648 | { |
| 1649 | int attIndex; |
| 1650 | |
| 1651 | for (attIndex = 0; attIndex < maxAttributeNumber; attIndex++) |
| 1652 | { |
| 1653 | OpClassCacheEnt *opcentry; |
| 1654 | |
| 1655 | if (!OidIsValid(indclass->values[attIndex])) |
| 1656 | elog(ERROR, "bogus pg_index tuple"); |
| 1657 | |
| 1658 | /* look up the info for this opclass, using a cache */ |
| 1659 | opcentry = LookupOpclassInfo(indclass->values[attIndex], |
| 1660 | maxSupportNumber); |
| 1661 | |
| 1662 | /* copy cached data into relcache entry */ |
| 1663 | opFamily[attIndex] = opcentry->opcfamily; |
| 1664 | opcInType[attIndex] = opcentry->opcintype; |
| 1665 | if (maxSupportNumber > 0) |
| 1666 | memcpy(&indexSupport[attIndex * maxSupportNumber], |
| 1667 | opcentry->supportProcs, |
| 1668 | maxSupportNumber * sizeof(RegProcedure)); |
| 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | /* |
| 1673 | * LookupOpclassInfo |
no test coverage detected