* Given a targetlist and a resno, return the matching TargetEntry * * Returns NULL if resno is not present in list. * * Note: we need to search, rather than just indexing with list_nth(), * because not all tlists are sorted by resno. */
| 3688 | * because not all tlists are sorted by resno. |
| 3689 | */ |
| 3690 | TargetEntry * |
| 3691 | get_tle_by_resno(List *tlist, AttrNumber resno) |
| 3692 | { |
| 3693 | ListCell *l; |
| 3694 | |
| 3695 | foreach(l, tlist) |
| 3696 | { |
| 3697 | TargetEntry *tle = (TargetEntry *) lfirst(l); |
| 3698 | |
| 3699 | if (tle->resno == resno) |
| 3700 | return tle; |
| 3701 | } |
| 3702 | return NULL; |
| 3703 | } |
| 3704 | |
| 3705 | /* |
| 3706 | * Given a Query and rangetable index, return relation's RowMarkClause if any |
no test coverage detected