From bdfbfde1b168b3332c4cdac34ac86a80aaf4d442 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 20 Jan 2003 18:55:07 +0000 Subject: 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. --- src/backend/nodes/outfuncs.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/backend/nodes/outfuncs.c') 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* @@ -905,6 +905,18 @@ _outMaterialPath(StringInfo str, MaterialPath *node) WRITE_NODE_FIELD(subpath); } +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) { @@ -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); -- cgit v1.2.1