Writeable CTE patch
Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>
From: Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>
To: pgsql-hackers@postgresql.org
Date: 2009-11-14T17:26:13Z
Lists: pgsql-hackers
Attachments
- writeablecte.patch (text/plain) patch
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