Re: [HACKERS] ERROR action extension for rules?

2004-04-21 Thread Fabien COELHO
CREATE RULE PasTouche AS ON UPDATE TO foo WHERE old.locked=TRUE DO INSTEAD ERROR; This would be sensible if rules were actually reasonable substitutes for triggers, but they are not. If you check the archives you will find many many cases where people tried to do this

[HACKERS] ERROR action extension for rules?

2004-04-20 Thread Fabien COELHO
Dear hackers, I'm trying to use some RULE as simple and maybe slower TRIGGER, so as to make it impossible for a row to be modified once a boolean is set to lock it. CREATE TABLE foo(data TEXT, locked BOOLEAN NOT NULL DEFAULT FALSE); This cannot be done with a CHECK constraint as it is not

Re: [HACKERS] ERROR action extension for rules?

2004-04-20 Thread Rod Taylor
CREATE RULE PasTouche AS ON UPDATE TO foo WHERE old.locked=TRUE DO INSTEAD ERROR; I think this simple new rule action could be added to pg. I'm planning to do it, if there is no opposition. Any comments on this proposed new rule action? Or did I missed something obvious

Re: [HACKERS] ERROR action extension for rules?

2004-04-20 Thread Tom Lane
Fabien COELHO [EMAIL PROTECTED] writes: I'm trying to use some RULE as simple and maybe slower TRIGGER, so as to make it impossible for a row to be modified once a boolean is set to lock it. ... However I thing that this would look much better to write simply: CREATE RULE PasTouche AS