Re: Allowing DML RULEs that produce Read Only actions during RO xacts

Simon Riggs <simon@2ndquadrant.com>

From: Simon Riggs <simon@2ndQuadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Date: 2009-12-06T16:09:18Z
Lists: pgsql-hackers
On Sun, 2009-12-06 at 10:26 -0500, Tom Lane wrote:
> 
> > +     /*
> > +      * If we're running a SELECT, allow it. This ensures that a
> > +      * write rule such as ON INSERT DO SELECT can be executed in
> > +      * a read-only session.
> > +      */
> > +     if (plannedstmt->commandType == CMD_SELECT)
> > +             return;
> 
> This will fail, very nastily, in writable-CTE cases.

If the feature is not able to be added easily, then I'm not interested
either. It's a nice-to-have and I have no time for anything more, so if
it gives problems in other areas, I would not pursue further.

One question: would a writable-CTE be running in a read-only xact?

-- 
 Simon Riggs           www.2ndQuadrant.com