Allowing DML RULEs that produce Read Only actions during RO xacts - Mailing list pgsql-hackers

From Simon Riggs
Subject Allowing DML RULEs that produce Read Only actions during RO xacts
Date
Msg-id 1260097373.13774.44448.camel@ebony
Whole thread Raw
Responses Re: Allowing DML RULEs that produce Read Only actions during RO xacts
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Hot standby, recent changes
Next
From: Simon Riggs
Date:
Subject: Re: Hot standby, recent changes