aboutsummaryrefslogtreecommitdiff
path: root/data/sql/commit.sql
diff options
context:
space:
mode:
Diffstat (limited to 'data/sql/commit.sql')
-rw-r--r--data/sql/commit.sql28
1 files changed, 28 insertions, 0 deletions
diff --git a/data/sql/commit.sql b/data/sql/commit.sql
new file mode 100644
index 00000000..346c5b76
--- /dev/null
+++ b/data/sql/commit.sql
@@ -0,0 +1,28 @@
+COMMIT;
+
+-- Do an explicit foreign_key_check as foreign key checking is a no-op within
+-- a transaction. Unfortunately we can't ask for this to be an error, so this
+-- is just for verbose output. In Makefile, we check this separately
+PRAGMA foreign_key_check;
+
+-- Final consistency checks
+CREATE TABLE dummy(foo);
+CREATE TRIGGER final_checks
+BEFORE INSERT ON dummy
+FOR EACH ROW BEGIN
+
+ -- check that view definitions have no error
+ SELECT RAISE(ABORT, 'corrupt definition of coordinate_operation_view')
+ WHERE (SELECT 1 FROM coordinate_operation_view LIMIT 1) = 0;
+ SELECT RAISE(ABORT, 'corrupt definition of crs_view')
+ WHERE (SELECT 1 FROM crs_view LIMIT 1) = 0;
+ SELECT RAISE(ABORT, 'corrupt definition of object_view')
+ WHERE (SELECT 1 FROM object_view LIMIT 1) = 0;
+ SELECT RAISE(ABORT, 'corrupt definition of authority_list')
+ WHERE (SELECT 1 FROM authority_list LIMIT 1) = 0;
+END;
+INSERT INTO dummy DEFAULT VALUES;
+DROP TRIGGER final_checks;
+DROP TABLE dummy;
+
+VACUUM; \ No newline at end of file