summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/pathkeys.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-02-18 23:47:31 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-02-18 23:47:31 +0000
commit3cbcb78a3dc1f716c1dab3dc7cac3c405b210533 (patch)
tree85012affb30f3b39d9553133cac879467c010da9 /src/backend/optimizer/path/pathkeys.c
parentbc8a39beef91e3d9bafafed031a8f997d0f61153 (diff)
downloadpostgresql-3cbcb78a3dc1f716c1dab3dc7cac3c405b210533.tar.gz
Plug some more memory leaks in the planner. It still leaks like a sieve,
but this is as good as it'll get for this release...
Diffstat (limited to 'src/backend/optimizer/path/pathkeys.c')
-rw-r--r--src/backend/optimizer/path/pathkeys.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/pathkeys.c b/src/backend/optimizer/path/pathkeys.c
index b578e33f5c..d5fbf82eb5 100644
--- a/src/backend/optimizer/path/pathkeys.c
+++ b/src/backend/optimizer/path/pathkeys.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.19 2000/02/15 20:49:17 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.20 2000/02/18 23:47:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -778,6 +778,7 @@ make_pathkeys_for_mergeclauses(Query *root,
Node *key;
Oid sortop;
PathKeyItem *item;
+ List *pathkey;
Assert(restrictinfo->mergejoinoperator != InvalidOid);
@@ -791,10 +792,21 @@ make_pathkeys_for_mergeclauses(Query *root,
key = (Node *) get_leftop(restrictinfo->clause);
sortop = restrictinfo->left_sortop;
/*
- * Add a pathkey sublist for this sort item
+ * Find pathkey sublist for this sort item. We expect to find
+ * the canonical set including the mergeclause's left and right
+ * sides; if we get back just the one item, something is rotten.
*/
item = makePathKeyItem(key, sortop);
- pathkeys = lappend(pathkeys, make_canonical_pathkey(root, item));
+ pathkey = make_canonical_pathkey(root, item);
+ Assert(length(pathkey) > 1);
+ /*
+ * Since the item we just made is not in the returned canonical set,
+ * we can free it --- this saves a useful amount of storage in a
+ * big join tree.
+ */
+ pfree(item);
+
+ pathkeys = lappend(pathkeys, pathkey);
}
return pathkeys;