* back to source text
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.167 2004/05/26 04:41:38 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.168 2004/05/26 19:30:12 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
get_names_for_var(Var *var, deparse_context *context,
char **schemaname, char **refname, char **attname)
{
- ListCell *nslist_item = list_head(context->namespaces);
- int sup = var->varlevelsup;
deparse_namespace *dpns;
RangeTblEntry *rte;
/* Find appropriate nesting depth */
- while (sup-- > 0 && nslist_item != NULL)
- nslist_item = lnext(nslist_item);
- if (nslist_item == NULL)
+ if (var->varlevelsup >= list_length(context->namespaces))
elog(ERROR, "bogus varlevelsup: %d", var->varlevelsup);
- dpns = (deparse_namespace *) lfirst(nslist_item);
+ dpns = (deparse_namespace *) list_nth(context->namespaces,
+ var->varlevelsup);
/* Find the relevant RTE */
if (var->varno >= 1 && var->varno <= length(dpns->rtable))
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.44 2004/05/26 04:41:45 neilc Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.45 2004/05/26 19:30:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* always be so; try to be careful to maintain the distinction.)
*/
-#define LIST_CELL_TYPE ListCell
-
typedef struct ListCell ListCell;
typedef struct List List;