Use the given attribute map to convert an attribute number in the * base relation to an attribute number in the other relation. Forgive * out-of-range attributes by mapping them to zero. Treat null as * the identity map. */
| 4154 | * the identity map. |
| 4155 | */ |
| 4156 | AttrNumber |
| 4157 | attrMap(TupleConversionMap *map, AttrNumber anum) |
| 4158 | { |
| 4159 | if (map == NULL) |
| 4160 | return anum; |
| 4161 | |
| 4162 | if (0 < anum && anum <= map->indesc->natts) |
| 4163 | { |
| 4164 | for (int i = 0; i < map->outdesc->natts; i++) |
| 4165 | { |
| 4166 | if (map->attrMap->attnums[i] == anum) |
| 4167 | return i + 1; |
| 4168 | } |
| 4169 | } |
| 4170 | return 0; |
| 4171 | } |
| 4172 | |
| 4173 | /* For attrMapExpr below. |
| 4174 | * |
no outgoing calls
no test coverage detected