Sha256: 00fdb8ec75602558bb27eb5310f5c9be1e84c016414ba06546dfdedf86630bc9
Contents?: true
Size: 769 Bytes
Versions: 3
Compression:
Stored size: 769 Bytes
Contents
CREATE OR REPLACE FUNCTION "%{table}_update" () RETURNS TRIGGER AS $$ DECLARE BEGIN IF OLD.obsoleted_dt <> 'infinity' THEN RAISE EXCEPTION 'can not update obsoleted append-only row'; END IF; -- If obsoleted_dt is being set, assume that the row is being -- obsoleted. We return the OLD row so that other field updates are -- ignored. This is used by DELETE. IF NEW.obsoleted_dt <> 'infinity' THEN OLD.obsoleted_dt = NEW.obsoleted_dt; OLD.o_user_id = NEW.o_user_id; return OLD; END IF; RAISE EXCEPTION 'can not update append-only row'; END; $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS %{table}_update ON %{table}; CREATE TRIGGER "%{table}_update" BEFORE UPDATE ON "%{table}" FOR EACH ROW EXECUTE PROCEDURE "%{table}_update"();
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mcfly-0.0.7 | lib/mcfly/update_append_only_trig.sql |
mcfly-0.0.6 | lib/mcfly/update_append_only_trig.sql |
mcfly-0.0.5 | lib/mcfly/update_append_only_trig.sql |