1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

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.
This commit is contained in:
Tom Lane
1999-05-13 07:29:22 +00:00
parent f80642137c
commit 507a0a2ab0
18 changed files with 192 additions and 288 deletions

View File

@ -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));