mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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.
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user