diff schema/gemma.sql @ 3533:8e083b271fca

Improve error messages if no matching gauge version found Avoid hitting the NOT NULL constraint of the referencing validity column in order to hit the foreign key constraint instead and emit an appropriate error message in all such cases.
author Tom Gottfried <tom@intevation.de>
date Wed, 29 May 2019 18:14:20 +0200
parents ba0339118d9c
children 337e9f85f84c
line wrap: on
line diff
--- a/schema/gemma.sql	Wed May 29 16:56:56 2019 +0200
+++ b/schema/gemma.sql	Wed May 29 18:14:20 2019 +0200
@@ -490,9 +490,9 @@
         bottleneck_id varchar UNIQUE NOT NULL,
         gauge_location isrs NOT NULL,
         gauge_validity tstzrange NOT NULL,
-        FOREIGN KEY (gauge_location, gauge_validity) REFERENCES gauges
-            ON UPDATE CASCADE,
-        -- XXX: DRC references "ch. 3.1.1", which does not exist in document.
+        CONSTRAINT gauge_key
+            FOREIGN KEY (gauge_location, gauge_validity) REFERENCES gauges
+                ON UPDATE CASCADE,
         objnam varchar,
         nobjnm varchar,
         stretch isrsrange NOT NULL,