diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-05-13 07:29:22 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-05-13 07:29:22 +0000 |
commit | 507a0a2ab09144f524e3239b7fc201ad1ad1b78e (patch) | |
tree | 77c434943724f627e3c901f06443f02ae57d467b /src/backend/parser/parse_clause.c | |
parent | f80642137cc0d2dbdaea68b8e439de0d50a5c01f (diff) | |
download | postgresql-507a0a2ab09144f524e3239b7fc201ad1ad1b78e.tar.gz postgresql-507a0a2ab09144f524e3239b7fc201ad1ad1b78e.zip |
Rip out QueryTreeList structure, root and branch. Querytree
lists are now plain old garden-variety Lists, allocated with palloc,
rather than specialized expansible-array data allocated with malloc.
This substantially simplifies their handling and eliminates several
sources of memory leakage.
Several basic types of erroneous queries (syntax error, attempt to
insert a duplicate key into a unique index) now demonstrably leak
zero bytes per query.
Diffstat (limited to 'src/backend/parser/parse_clause.c')
-rw-r--r-- | src/backend/parser/parse_clause.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index 61359e3452a..ceabc549a3d 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.30 1999/05/12 15:01:50 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.31 1999/05/13 07:28:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -752,23 +752,24 @@ List * transformUnionClause(List *unionClause, List *targetlist) { List *union_list = NIL; - QueryTreeList *qlist; - int i; + List *qlist, + *qlist_item; if (unionClause) { /* recursion */ qlist = parse_analyze(unionClause, NULL); - for (i = 0; i < qlist->len; i++) + foreach (qlist_item, qlist) { + Query *query = (Query *) lfirst(qlist_item); List *prev_target = targetlist; List *next_target; - if (length(targetlist) != length(qlist->qtrees[i]->targetList)) + if (length(targetlist) != length(query->targetList)) elog(ERROR, "Each UNION clause must have the same number of columns"); - foreach(next_target, qlist->qtrees[i]->targetList) + foreach(next_target, query->targetList) { Oid itype; Oid otype; @@ -819,7 +820,7 @@ transformUnionClause(List *unionClause, List *targetlist) } prev_target = lnext(prev_target); } - union_list = lappend(union_list, qlist->qtrees[i]); + union_list = lappend(union_list, query); } return union_list; } |