diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-08-11 20:46:47 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-08-11 20:46:47 +0000 |
commit | 88381ade63de931c84f53dc873c986d40b8c8b61 (patch) | |
tree | 1ec3c77e29b1d320718b64b38db10f8a8f0e0cd3 /src/backend/executor/execJunk.c | |
parent | cae912d05bfb354d81427c6ae5354eab90869fe9 (diff) | |
download | postgresql-88381ade63de931c84f53dc873c986d40b8c8b61.tar.gz postgresql-88381ade63de931c84f53dc873c986d40b8c8b61.zip |
Code cleanup inspired by recent resname bug report (doesn't fix the bug
yet, though). Avoid using nth() to fetch tlist entries; provide a
common routine get_tle_by_resno() to search a tlist for a particular
resno. This replaces a couple uses of nth() and a dozen hand-coded
search loops. Also, replace a few uses of nth(length-1, list) with
llast().
Diffstat (limited to 'src/backend/executor/execJunk.c')
-rw-r--r-- | src/backend/executor/execJunk.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c index e976729a803..654fc7811a8 100644 --- a/src/backend/executor/execJunk.c +++ b/src/backend/executor/execJunk.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.35 2003/08/04 02:39:58 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.36 2003/08/11 20:46:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -185,10 +185,7 @@ ExecGetJunkAttribute(JunkFilter *junkfilter, { List *targetList; List *t; - Resdom *resdom; AttrNumber resno; - char *resname; - bool resjunk; TupleDesc tupType; HeapTuple tuple; @@ -202,11 +199,10 @@ ExecGetJunkAttribute(JunkFilter *junkfilter, foreach(t, targetList) { TargetEntry *tle = lfirst(t); + Resdom *resdom = tle->resdom; - resdom = tle->resdom; - resname = resdom->resname; - resjunk = resdom->resjunk; - if (resjunk && (strcmp(resname, attrName) == 0)) + if (resdom->resjunk && resdom->resname && + (strcmp(resdom->resname, attrName) == 0)) { /* We found it ! */ resno = resdom->resno; |