Return a bitmap representing columns being inserted */
| 1311 | |
| 1312 | /* Return a bitmap representing columns being inserted */ |
| 1313 | Bitmapset * |
| 1314 | ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate) |
| 1315 | { |
| 1316 | /* |
| 1317 | * The columns are stored in the range table entry. If this ResultRelInfo |
| 1318 | * represents a partition routing target, and doesn't have an entry of its |
| 1319 | * own in the range table, fetch the parent's RTE and map the columns to |
| 1320 | * the order they are in the partition. |
| 1321 | */ |
| 1322 | if (relinfo->ri_RangeTableIndex != 0) |
| 1323 | { |
| 1324 | RangeTblEntry *rte = exec_rt_fetch(relinfo->ri_RangeTableIndex, estate); |
| 1325 | |
| 1326 | return rte->insertedCols; |
| 1327 | } |
| 1328 | else if (relinfo->ri_RootResultRelInfo) |
| 1329 | { |
| 1330 | ResultRelInfo *rootRelInfo = relinfo->ri_RootResultRelInfo; |
| 1331 | RangeTblEntry *rte = exec_rt_fetch(rootRelInfo->ri_RangeTableIndex, estate); |
| 1332 | |
| 1333 | if (relinfo->ri_RootToPartitionMap != NULL) |
| 1334 | return execute_attr_map_cols(relinfo->ri_RootToPartitionMap->attrMap, |
| 1335 | rte->insertedCols); |
| 1336 | else |
| 1337 | return rte->insertedCols; |
| 1338 | } |
| 1339 | else |
| 1340 | { |
| 1341 | /* |
| 1342 | * The relation isn't in the range table and it isn't a partition |
| 1343 | * routing target. This ResultRelInfo must've been created only for |
| 1344 | * firing triggers and the relation is not being inserted into. (See |
| 1345 | * ExecGetTriggerResultRel.) |
| 1346 | */ |
| 1347 | return NULL; |
| 1348 | } |
| 1349 | } |
| 1350 | |
| 1351 | /* Return a bitmap representing columns being updated */ |
| 1352 | Bitmapset * |
no test coverage detected