aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-05-13 07:29:22 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-05-13 07:29:22 +0000
commit507a0a2ab09144f524e3239b7fc201ad1ad1b78e (patch)
tree77c434943724f627e3c901f06443f02ae57d467b /src/backend/executor/functions.c
parentf80642137cc0d2dbdaea68b8e439de0d50a5c01f (diff)
downloadpostgresql-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/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 1cb57d5651e..f9b729b8386 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.24 1999/02/13 23:15:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.25 1999/05/13 07:28:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,26 +97,23 @@ init_execution_state(FunctionCachePtr fcache,
execution_state *newes;
execution_state *nextes;
execution_state *preves;
- QueryTreeList *queryTree_list;
- int i;
- List *planTree_list;
- int nargs;
-
- nargs = fcache->nargs;
+ List *queryTree_list,
+ *planTree_list,
+ *qtl_item;
+ int nargs = fcache->nargs;
newes = (execution_state *) palloc(sizeof(execution_state));
nextes = newes;
preves = (execution_state *) NULL;
+ planTree_list = pg_parse_and_plan(fcache->src, fcache->argOidVect,
+ nargs, &queryTree_list, None, FALSE);
- planTree_list = (List *)
- pg_parse_and_plan(fcache->src, fcache->argOidVect, nargs, &queryTree_list, None, FALSE);
-
- for (i = 0; i < queryTree_list->len; i++)
+ foreach (qtl_item, queryTree_list)
{
- EState *estate;
- Query *queryTree = (Query *) (queryTree_list->qtrees[i]);
+ Query *queryTree = lfirst(qtl_item);
Plan *planTree = lfirst(planTree_list);
+ EState *estate;
if (!nextes)
nextes = (execution_state *) palloc(sizeof(execution_state));