M Open-ILS/src/sql/Pg/999.functions.global.sql
M Open-ILS/src/sql/Pg/002.schema.config.sql
A Open-ILS/src/sql/Pg/upgrade/0293.function.interval-to-seconds.sql
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16594
dcc99617-32d9-48b4-a31d-
7c20da2025e4
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0292'); -- dbs
+INSERT INTO config.upgrade_log (version) VALUES ('0293'); -- Scott McKellar
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
CREATE TRIGGER aaa_indexing_ingest_or_delete AFTER INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE biblio.indexing_ingest_or_delete ();
CREATE TRIGGER bbb_simple_rec_trigger AFTER INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE reporter.simple_rec_trigger ();
+-- Utility routines, callable via cstore
+
+CREATE OR REPLACE FUNCTION config.interval_to_seconds( interval_val INTERVAL )
+RETURNS INTEGER AS $$
+BEGIN
+ RETURN EXTRACT( EPOCH FROM interval_val );
+END;
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION config.interval_to_seconds( interval_string TEXT )
+RETURNS INTEGER AS $$
+BEGIN
+ RETURN config.interval_to_seconds( interval_string::INTERVAL );
+END;
+$$ LANGUAGE plpgsql;
--- /dev/null
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0293'); -- Scott McKellar
+
+CREATE OR REPLACE FUNCTION config.interval_to_seconds( interval_val INTERVAL )
+RETURNS INTEGER AS $$
+BEGIN
+ RETURN EXTRACT( EPOCH FROM interval_val );
+END;
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION config.interval_to_seconds( interval_string TEXT )
+RETURNS INTEGER AS $$
+BEGIN
+ RETURN config.interval_to_seconds( interval_string::INTERVAL );
+END;
+$$ LANGUAGE plpgsql;
+
+COMMIT;