From: | Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Status report on writeable CTEs |
Date: | 2010-07-12 18:07:35 |
Message-ID: | 4C3B59E7.7090002@cs.helsinki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I've been working on writeable CTEs during the last couple of months,
but right now it looks like I'm going to miss the first commit fest for
9.1. I was trying to make it work by expanding all wCTEs to their own
Queries during the rewrite stage (a very crude patch trying to do that
for regular CTEs attached), but I don't think that it's a good way of
approaching the problem. Consider:
WITH t AS (SELECT 1),
t2 AS (SELECT * FROM t2)
VALUES (true);
The first big problem I hit is was that when the query for t2 is planned
separately, it doesn't have the CTE information. But even if it had
that information (we could easily copy it during the rewrite stage), all
RTEs referencing CTEs that were expanded would have the wrong levelsup
(this is where the patch fails at regression tests). One could probably
come up with ways of fixing even that, but I don't think that's the
right direction to be heading.
So what I'm now thinking of is making the planner plan that as a single
Query, and make the planner expand it into multiple PlannedStmts if
necessary. This would break the existing planner hooks, but I don't
think that's a huge problem. Does anyone see any obvious flaws in this?
Any feedback is welcome. I'd also be happy to get some help on this
project.
Regards,
Marko Tiikkaja
Attachment | Content-Type | Size |
---|---|---|
wcte.patch | text/plain | 38.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Marko Tiikkaja | 2010-07-12 18:21:52 | Re: Status report on writeable CTEs |
Previous Message | Pavel Stehule | 2010-07-12 17:36:18 | Re: patch (for 9.1) string functions |