Writeable CTE patch

From: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Writeable CTE patch
Date: 2009-11-14 17:26:13
Message-ID: 4AFEE835.5070606@cs.helsinki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Attached is the latest version of this patch.

I altered rewriting a bit (I've brought the problems with the previous
approach up a couple of times before) and this version should have the
expected output in all situations. This patch doesn't allow you to use
INSERT/UPDATE/DELETE as the top level statement, but you can get around
that by putting the desired top-level statement in a new CTE.

Since the last patch I also moved ExecOpenIndices to nodeModifyTable.c
because the top-level executor doesn't know which result relations are
opened for which operations.

One thing which has bothered me a while is that there is no clear option
for commandType when you have a multiple types of statements in a single
Query. In some places it'd help to know that there are multiple
different statements. This is now achieved by having hasWritableCtes
variable in PlannedStmt, but that doesn't help in places where you don't
have access to (or there isn't yet one) PlannedStmt, which has lead me
to think that we could have a CMD_MULTI or a similar value to mark these
Queries. I haven't taken the time to look at this in detail, but it's
something to think about.

Regards,
Marko Tiikkaja

Attachment Content-Type Size
writeablecte.patch text/plain 43.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-11-14 17:39:51 Re: Inspection of row types in pl/pgsql and pl/sql
Previous Message Pavel Stehule 2009-11-14 17:21:24 Re: Inspection of row types in pl/pgsql and pl/sql