summaryrefslogtreecommitdiff
path: root/src/backend/nodes/outfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-01-20 18:55:07 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-01-20 18:55:07 +0000
commitbdfbfde1b168b3332c4cdac34ac86a80aaf4d442 (patch)
treef35bf1af04733069f3a6b0a2698ac10dbd6544ed /src/backend/nodes/outfuncs.c
parentbe2b660ecd5ca205570825633e7b8479379ddc64 (diff)
downloadpostgresql-bdfbfde1b168b3332c4cdac34ac86a80aaf4d442.tar.gz
IN clauses appearing at top level of WHERE can now be handled as joins.
There are two implementation techniques: the executor understands a new JOIN_IN jointype, which emits at most one matching row per left-hand row, or the result of the IN's sub-select can be fed through a DISTINCT filter and then joined as an ordinary relation. Along the way, some minor code cleanup in the optimizer; notably, break out most of the jointree-rearrangement preprocessing in planner.c and put it in a new file prep/prepjointree.c.
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r--src/backend/nodes/outfuncs.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index e72b52570e..fd18c957d9 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.193 2003/01/15 19:35:39 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.194 2003/01/20 18:54:47 tgl Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
@@ -906,6 +906,18 @@ _outMaterialPath(StringInfo str, MaterialPath *node)
}
static void
+_outUniquePath(StringInfo str, UniquePath *node)
+{
+ WRITE_NODE_TYPE("UNIQUEPATH");
+
+ _outPathInfo(str, (Path *) node);
+
+ WRITE_NODE_FIELD(subpath);
+ WRITE_BOOL_FIELD(use_hash);
+ WRITE_FLOAT_FIELD(rows, "%.0f");
+}
+
+static void
_outNestPath(StringInfo str, NestPath *node)
{
WRITE_NODE_TYPE("NESTPATH");
@@ -969,6 +981,16 @@ _outJoinInfo(StringInfo str, JoinInfo *node)
WRITE_NODE_FIELD(jinfo_restrictinfo);
}
+static void
+_outInClauseInfo(StringInfo str, InClauseInfo *node)
+{
+ WRITE_NODE_TYPE("INCLAUSEINFO");
+
+ WRITE_INTLIST_FIELD(lefthand);
+ WRITE_INTLIST_FIELD(righthand);
+ WRITE_NODE_FIELD(sub_targetlist);
+}
+
/*****************************************************************************
*
* Stuff from parsenodes.h.
@@ -1563,6 +1585,9 @@ _outNode(StringInfo str, void *obj)
case T_MaterialPath:
_outMaterialPath(str, obj);
break;
+ case T_UniquePath:
+ _outUniquePath(str, obj);
+ break;
case T_NestPath:
_outNestPath(str, obj);
break;
@@ -1581,6 +1606,9 @@ _outNode(StringInfo str, void *obj)
case T_JoinInfo:
_outJoinInfo(str, obj);
break;
+ case T_InClauseInfo:
+ _outInClauseInfo(str, obj);
+ break;
case T_CreateStmt:
_outCreateStmt(str, obj);