aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_expr.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/parser/parse_expr.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/parser/parse_expr.c')
-rw-r--r--src/backend/parser/parse_expr.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 24b1e1b91d2..91bba7fc277 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -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)
{