mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +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/rewrite/rewriteDefine.c,v 1.129 2008/08/25 22:42:34 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.130 2008/10/04 21:56:54 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -635,17 +635,23 @@ setRuleCheckAsUser_Query(Query *qry, Oid userid)
|
||||
rte->checkAsUser = userid;
|
||||
}
|
||||
|
||||
/* Recurse into subquery-in-WITH */
|
||||
foreach(l, qry->cteList)
|
||||
{
|
||||
CommonTableExpr *cte = (CommonTableExpr *) lfirst(l);
|
||||
|
||||
setRuleCheckAsUser_Query((Query *) cte->ctequery, userid);
|
||||
}
|
||||
|
||||
/* If there are sublinks, search for them and process their RTEs */
|
||||
/* ignore subqueries in rtable because we already processed them */
|
||||
if (qry->hasSubLinks)
|
||||
query_tree_walker(qry, setRuleCheckAsUser_walker, (void *) &userid,
|
||||
QTW_IGNORE_RT_SUBQUERIES);
|
||||
QTW_IGNORE_RC_SUBQUERIES);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Change the firing semantics of an existing rule.
|
||||
*
|
||||
*/
|
||||
void
|
||||
EnableDisableRule(Relation rel, const char *rulename,
|
||||
|
Reference in New Issue
Block a user