aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/common')
-rw-r--r--src/backend/access/common/printtup.c17
-rw-r--r--src/backend/access/common/tupdesc.c10
2 files changed, 14 insertions, 13 deletions
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index 664c884a712..eb05c994b46 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.80 2004/01/07 18:56:23 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.81 2004/05/26 04:41:03 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -138,7 +138,7 @@ printtup_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
List *targetlist;
if (portal->strategy == PORTAL_ONE_SELECT)
- targetlist = ((Query *) lfirst(portal->parseTrees))->targetList;
+ targetlist = ((Query *) linitial(portal->parseTrees))->targetList;
else
targetlist = NIL;
@@ -176,6 +176,7 @@ SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist, int16 *formats)
int proto = PG_PROTOCOL_MAJOR(FrontendProtocol);
int i;
StringInfoData buf;
+ ListCell *tlist_item = list_head(targetlist);
pq_beginmessage(&buf, 'T'); /* tuple descriptor message type */
pq_sendint(&buf, natts, 2); /* # of attrs in tuples */
@@ -191,16 +192,16 @@ SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist, int16 *formats)
if (proto >= 3)
{
/* Do we have a non-resjunk tlist item? */
- while (targetlist &&
- ((TargetEntry *) lfirst(targetlist))->resdom->resjunk)
- targetlist = lnext(targetlist);
- if (targetlist)
+ while (tlist_item &&
+ ((TargetEntry *) lfirst(tlist_item))->resdom->resjunk)
+ tlist_item = lnext(tlist_item);
+ if (tlist_item)
{
- Resdom *res = ((TargetEntry *) lfirst(targetlist))->resdom;
+ Resdom *res = ((TargetEntry *) lfirst(tlist_item))->resdom;
pq_sendint(&buf, res->resorigtbl, 4);
pq_sendint(&buf, res->resorigcol, 2);
- targetlist = lnext(targetlist);
+ tlist_item = lnext(tlist_item);
}
else
{
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index 1a016d86f80..4a3c2721c7b 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.102 2004/04/01 21:28:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.103 2004/05/26 04:41:03 neilc Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -472,7 +472,7 @@ BuildDescForRelation(List *schema)
{
int natts;
AttrNumber attnum;
- List *p;
+ ListCell *l;
TupleDesc desc;
AttrDefault *attrdef = NULL;
TupleConstr *constr = (TupleConstr *) palloc0(sizeof(TupleConstr));
@@ -490,9 +490,9 @@ BuildDescForRelation(List *schema)
attnum = 0;
- foreach(p, schema)
+ foreach(l, schema)
{
- ColumnDef *entry = lfirst(p);
+ ColumnDef *entry = lfirst(l);
/*
* for each entry in the list, get the name and type information
@@ -661,7 +661,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
errmsg("number of aliases does not match number of columns")));
/* OK, get the column alias */
- attname = strVal(lfirst(colaliases));
+ attname = strVal(linitial(colaliases));
tupdesc = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry(tupdesc,