mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Implement SQL-standard WITH clauses, including WITH RECURSIVE.
There are some unimplemented aspects: recursive queries must use UNION ALL (should allow UNION too), and we don't have SEARCH or CYCLE clauses. These might or might not get done for 8.4, but even without them it's a pretty useful feature. There are also a couple of small loose ends and definitional quibbles, which I'll send a memo about to pgsql-hackers shortly. But let's land the patch now so we can get on with other development. Yoshiyuki Asaba, with lots of help from Tatsuo Ishii and Tom Lane
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.147 2008/09/05 21:07:29 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.148 2008/10/04 21:56:53 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1219,6 +1219,45 @@ create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel)
|
||||
return pathnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* create_ctescan_path
|
||||
* Creates a path corresponding to a scan of a non-self-reference CTE,
|
||||
* returning the pathnode.
|
||||
*/
|
||||
Path *
|
||||
create_ctescan_path(PlannerInfo *root, RelOptInfo *rel)
|
||||
{
|
||||
Path *pathnode = makeNode(Path);
|
||||
|
||||
pathnode->pathtype = T_CteScan;
|
||||
pathnode->parent = rel;
|
||||
pathnode->pathkeys = NIL; /* XXX for now, result is always unordered */
|
||||
|
||||
cost_ctescan(pathnode, root, rel);
|
||||
|
||||
return pathnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* create_worktablescan_path
|
||||
* Creates a path corresponding to a scan of a self-reference CTE,
|
||||
* returning the pathnode.
|
||||
*/
|
||||
Path *
|
||||
create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel)
|
||||
{
|
||||
Path *pathnode = makeNode(Path);
|
||||
|
||||
pathnode->pathtype = T_WorkTableScan;
|
||||
pathnode->parent = rel;
|
||||
pathnode->pathkeys = NIL; /* result is always unordered */
|
||||
|
||||
/* Cost is the same as for a regular CTE scan */
|
||||
cost_ctescan(pathnode, root, rel);
|
||||
|
||||
return pathnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* create_nestloop_path
|
||||
* Creates a pathnode corresponding to a nestloop join between two
|
||||
|
Reference in New Issue
Block a user