From 88381ade63de931c84f53dc873c986d40b8c8b61 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 11 Aug 2003 20:46:47 +0000 Subject: 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(). --- src/include/parser/parsetree.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/include/parser') diff --git a/src/include/parser/parsetree.h b/src/include/parser/parsetree.h index a172b25bd3e..d69acffeff3 100644 --- a/src/include/parser/parsetree.h +++ b/src/include/parser/parsetree.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parsetree.h,v 1.21 2003/08/04 02:40:14 momjian Exp $ + * $Id: parsetree.h,v 1.22 2003/08/11 20:46:47 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ /* ---------------- - * range table macros + * range table operations * ---------------- */ @@ -55,4 +55,12 @@ extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum); extern void get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum, Oid *vartype, int32 *vartypmod); + +/* ---------------- + * target list operations + * ---------------- + */ + +extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno); + #endif /* PARSETREE_H */ -- cgit v1.2.3