Allowing DML RULEs that produce Read Only actions during RO xacts
Simon Riggs <simon@2ndquadrant.com>
From: Simon Riggs <simon@2ndQuadrant.com>
To: pgsql-hackers@postgresql.org
Date: 2009-12-06T11:02:53Z
Lists: pgsql-hackers
Attachments
- ro_dml_rules.v1.patch (text/x-patch) patch v1
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. CREATE RULE foorah AS ON INSERT TO foo DO INSTEAD SELECT remote_insert(NEW.col1, NEW.col2, ...); The above rule is currently disallowed during READ ONLY transactions, even though the write action is re-written into a read-only action. I have a small patch that allows this, attached here with test cases. 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. -- Simon Riggs www.2ndQuadrant.com