"Alvaro Herrera" <alvherre@commandprompt.com> writes:
> What ideas?
Basically I think what we should do is extend SQL to support things like
UPDATE (subquery) SET ...
DELETE FROM (subquery) WHERE ...
Ie, do the update-able view magic in the planner and executor rather than in
the rewriter. Then the rewriter just has the same work to do that it does for
SELECTs, namely substitute the view in the right place in the query. We don't
have the rewriter try to reverse-engineer SELECTS and flatten the view into
the outer query, it shouldn't be trying to do that for UPDATEs and DELETEs
either.
Oracle does actually support syntax like this, even for joins, and it's
awfully convenient for UPDATE where it handles the same kind of cases we use
our UPDATE ... FROM syntax.
-- Gregory Stark EnterpriseDB http://www.enterprisedb.com