| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Allowing DML RULEs that produce Read Only actions during RO xacts |
| Date: | 2009-12-06 15:26:48 |
| Message-ID: | 23554.1260113208@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> I would like to allow RULEs ON INSERT, ON UPDATE and ON DELETE during
> read only transactions iff they generate only SELECT statements that act
> INSTEAD OF the actual event.
I don't actually believe there is any use case for such a thing.
> This would be a small, but useful additional feature for Hot Standby,
> since it would allow INSERT, UPDATE, DELETE statements to be re-routed,
> for various applications.
How would you "reroute" them without a non-read-only operation happening
somewhere along the line?
> + /*
> + * 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.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Simon Riggs | 2009-12-06 15:46:40 | Re: Allowing DML RULEs that produce Read Only actions during RO xacts |
| Previous Message | Tom Lane | 2009-12-06 15:23:49 | Re: Cancelling idle in transaction state |