Changeset 9457 for branches/rel_1_2/Open-ILS/src/sql/Pg/reporter-schema.sql
- Timestamp:
- 04/26/08 12:48:27 (6 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/rel_1_2/Open-ILS/src/sql/Pg/reporter-schema.sql
r9455 r9457 133 133 GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14; 134 134 135 CREATE OR REPLACE VIEW reporter. super_simple_record AS135 CREATE OR REPLACE VIEW reporter.old_super_simple_record AS 136 136 SELECT r.id, 137 137 r.fingerprint, … … 155 155 GROUP BY 1,2,3,4,5,6,8,9; 156 156 157 CREATE TABLE reporter.materialized_simple_record AS SELECT * FROM reporter. simple_record WHERE 1=0;157 CREATE TABLE reporter.materialized_simple_record AS SELECT * FROM reporter.old_super_simple_record WHERE 1=0; 158 158 ALTER TABLE reporter.materialized_simple_record ADD PRIMARY KEY (id); 159 160 CREATE VIEW reporter.super_simple_record AS SELECT * FROM reporter.materialized_simple_record; 159 161 160 162 CREATE OR REPLACE FUNCTION reporter.simple_rec_sync () RETURNS TRIGGER AS $$ … … 165 167 166 168 IF TG_OP IN ('INSERT','UPDATE') AND NOT NEW.deleted THEN 167 INSERT INTO reporter.materialized_simple_record SELECT * FROM reporter. simple_record WHERE id = NEW.record;169 INSERT INTO reporter.materialized_simple_record SELECT * FROM reporter.old_super_simple_record WHERE id = NEW.record; 168 170 END IF; 169 171
