CREATE TABLE ref ( name TEXT NOT NULL PRIMARY KEY ); CREATE TABLE test ( id SERIAL PRIMARY KEY, col1 TEXT NOT NULL UNIQUE, col2 TEXT NOT NULL REFERENCES ref ON UPDATE CASCADE ); CREATE TABLE log ( id INTEGER NOT NULL, col1 TEXT NOT NULL, col2 TEXT NOT NULL ); CREATE OR REPLACE RULE log AS ON UPDATE TO test DO INSERT INTO log VALUES (OLD.id,OLD.col1,OLD.col2); CREATE VIEW bug AS SELECT * FROM test; CREATE OR REPLACE RULE upd AS ON UPDATE TO bug DO INSTEAD NOTHING; CREATE OR REPLACE RULE upd_col1 AS ON UPDATE TO bug WHERE NEW.col1 <> OLD.col1 DO UPDATE test SET col1 = NEW.col1 WHERE id = OLD.id; CREATE OR REPLACE RULE upd_col2 AS ON UPDATE TO bug WHERE NEW.col2 <> OLD.col2 DO UPDATE test SET col2 = NEW.col2 WHERE id = OLD.id; INSERT INTO ref (name) VALUES ('Name'); INSERT INTO test (col1,col2) VALUES ('Test 1','Name'); UPDATE bug SET col1 = 'Test' WHERE id = 1;