Currently, there is a limitation in PostgreSQL that any ON SELECT RULE must be 
an unconditional SELECT action that is INSTEAD.

The reasoning is "This restriction was required to make rules safe enough to 
open them for ordinary users, and it restricts ON SELECT rules to act like 
views."


I cannot understand the logic behind this, as RULES are created by DBA's. 
Besides, going by that logic, a user could create a RULE like



CREATE RULE silly AS ON SELECT

    TO table_a   DO INSTEAD  SELECT * FROM table_b.



Not to mention, an INSERT, UPDATE, or DELETE rule is potentially much more 
dangerous.

eg: ON INSERT DO INSTEAD SELECT function_to_delete();



Is that safe? Furthermore, it would be more beneficial to allow DO ALSO, so 
that an audit function could be invoked.



Likewise, the same applies to TRIGGERS. ON SELECT should also be an option 
there for the same reason.



Is there some way that modifying the CREATE RULE for SELECT, and/or TRIGGER 
could be presented to the developers?



Thanks in advance,

Melvin Davidson.

Reply via email to