* IndexScanOK * * This function checks for tuples that will be fetched by * IndexSupportInitialize() during relcache initialization for * certain system indexes that support critical syscaches. * We can't use an indexscan to fetch these, else we'll get into * infinite recursion. A plain heap scan will work, however. * Once we have completed relcache initialization (signaled by * c
| 1082 | * catalogs' indexes. |
| 1083 | */ |
| 1084 | static bool |
| 1085 | IndexScanOK(CatCache *cache, ScanKey cur_skey) |
| 1086 | { |
| 1087 | switch (cache->id) |
| 1088 | { |
| 1089 | case INDEXRELID: |
| 1090 | |
| 1091 | /* |
| 1092 | * Rather than tracking exactly which indexes have to be loaded |
| 1093 | * before we can use indexscans (which changes from time to time), |
| 1094 | * just force all pg_index searches to be heap scans until we've |
| 1095 | * built the critical relcaches. |
| 1096 | */ |
| 1097 | if (!criticalRelcachesBuilt) |
| 1098 | return false; |
| 1099 | break; |
| 1100 | |
| 1101 | case AMOID: |
| 1102 | case AMNAME: |
| 1103 | |
| 1104 | /* |
| 1105 | * Always do heap scans in pg_am, because it's so small there's |
| 1106 | * not much point in an indexscan anyway. We *must* do this when |
| 1107 | * initially building critical relcache entries, but we might as |
| 1108 | * well just always do it. |
| 1109 | */ |
| 1110 | return false; |
| 1111 | |
| 1112 | case AUTHNAME: |
| 1113 | case AUTHOID: |
| 1114 | case AUTHMEMMEMROLE: |
| 1115 | case DATABASEOID: |
| 1116 | case PROFILEID: |
| 1117 | case PROFILENAME: |
| 1118 | |
| 1119 | /* |
| 1120 | * Protect authentication lookups occurring before relcache has |
| 1121 | * collected entries for shared indexes. |
| 1122 | */ |
| 1123 | if (!criticalSharedRelcachesBuilt) |
| 1124 | return false; |
| 1125 | break; |
| 1126 | |
| 1127 | default: |
| 1128 | break; |
| 1129 | } |
| 1130 | |
| 1131 | /* Normal case, allow index scan */ |
| 1132 | return true; |
| 1133 | } |
| 1134 | |
| 1135 | /* |
| 1136 | * This function performs checks for certain system tables to validate tuple |
no outgoing calls
no test coverage detected