1 -- VIEWS for the oai service
4 -- The view presents a lean table with unique bre.tc-numbers for oai paging;
5 CREATE VIEW oai.biblio AS
8 bre.edit_date AS datestamp,
11 biblio.record_entry bre
15 -- The view presents a lean table with unique are.tc-numbers for oai paging;
16 CREATE VIEW oai.authority AS
19 are.edit_date AS datestamp,
20 are.deleted AS deleted
22 authority.record_entry AS are
26 -- If an edit date changes in the asset.call_number or asset.copy and you want this to persist to an OAI2 datestamp,
27 -- then add these stored procedures and triggers:
28 CREATE OR REPLACE FUNCTION oai.datestamp(rid BIGINT)
31 UPDATE biblio.record_entry AS bre
37 CREATE OR REPLACE FUNCTION oai.call_number_datestamp()
42 PERFORM oai.datestamp(OLD.record);
46 PERFORM oai.datestamp(NEW.record);
52 CREATE OR REPLACE FUNCTION oai.copy_datestamp()
57 PERFORM oai.datestamp((SELECT acn.record FROM asset.call_number as acn WHERE acn.id = OLD.call_number));
61 PERFORM oai.datestamp((SELECT acn.record FROM asset.call_number as acn WHERE acn.id = NEW.call_number));
67 CREATE TRIGGER call_number_datestamp AFTER INSERT OR UPDATE OR DELETE ON asset.call_number FOR EACH ROW EXECUTE PROCEDURE oai.call_number_datestamp();
68 CREATE TRIGGER copy_datestamp AFTER INSERT OR UPDATE OR DELETE ON asset.copy FOR EACH ROW EXECUTE PROCEDURE oai.copy_datestamp();