From ff9a386c72afb277aa79b86c7efb54e9843e810a Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Tue, 6 Oct 2020 17:08:29 +0200
Subject: Database: import datum ensemble accuracy and members (but do not use
 them)

---
 data/sql/commit.sql | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'data/sql/commit.sql')

diff --git a/data/sql/commit.sql b/data/sql/commit.sql
index d6293b1f..53c571b6 100644
--- a/data/sql/commit.sql
+++ b/data/sql/commit.sql
@@ -44,6 +44,20 @@ FOR EACH ROW BEGIN
             AND NOT (o.auth_name = 'IGNF' AND o.table_name IN ('geodetic_datum', 'vertical_datum', 'conversion'))
         );
 
+    SELECT RAISE(ABORT, 'Geodetic datum ensemble defined, but no ensemble member')
+        WHERE EXISTS (
+            SELECT * FROM geodetic_datum d WHERE ensemble_accuracy IS NOT NULL
+            AND NOT EXISTS (SELECT 1 FROM geodetic_datum_ensemble_member WHERE
+                d.auth_name = ensemble_auth_name AND d.code = ensemble_code)
+        );
+
+    SELECT RAISE(ABORT, 'Vertical datum ensemble defined, but no ensemble member')
+        WHERE EXISTS (
+            SELECT * FROM vertical_datum d WHERE ensemble_accuracy IS NOT NULL
+            AND NOT EXISTS (SELECT 1 FROM vertical_datum_ensemble_member WHERE
+                d.auth_name = ensemble_auth_name AND d.code = ensemble_code)
+        );
+
     -- test to check that our custom grid transformation overrides are really needed
     SELECT RAISE(ABORT, 'PROJ grid_transformation defined whereas EPSG has one')
         WHERE EXISTS (SELECT 1 FROM grid_transformation g1
-- 
cgit v1.2.3

