1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +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

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.44 1999/05/12 07:14:24 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.45 1999/05/13 07:28:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -274,16 +274,19 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
case T_SubLink:
{
SubLink *sublink = (SubLink *) expr;
QueryTreeList *qtree;
List *qtrees;
Query *qtree;
List *llist;
pstate->p_hasSubLinks = true;
qtree = parse_analyze(lcons(sublink->subselect, NIL), pstate);
if (qtree->len != 1 ||
qtree->qtrees[0]->commandType != CMD_SELECT ||
qtree->qtrees[0]->resultRelation != 0)
qtrees = parse_analyze(lcons(sublink->subselect, NIL), pstate);
if (length(qtrees) != 1)
elog(ERROR, "parser: bad query in subselect");
sublink->subselect = (Node *) qtree->qtrees[0];
qtree = (Query *) lfirst(qtrees);
if (qtree->commandType != CMD_SELECT ||
qtree->resultRelation != 0)
elog(ERROR, "parser: bad query in subselect");
sublink->subselect = (Node *) qtree;
if (sublink->subLinkType != EXISTS_SUBLINK)
{