diff schema/gemma.sql @ 4895:9f799077a3e6 fairway-marks-import

Prevent importing non-distinct fairway marks
author Tom Gottfried <tom@intevation.de>
date Tue, 14 Jan 2020 18:24:51 +0100
parents 8eb36d0d5bdf
children dd888bbb7e43
line wrap: on
line diff
--- a/schema/gemma.sql	Tue Jan 14 15:01:42 2020 +0100
+++ b/schema/gemma.sql	Tue Jan 14 18:24:51 2020 +0100
@@ -864,6 +864,14 @@
         catlam int,
         dirimp smallint REFERENCES dirimps
     )
+    -- Prevent identical entries using composite type comparison
+    -- (i.e. considering two NULL values in a field equal):
+    CREATE UNIQUE INDEX fairway_marks_distinct_rows ON fairway_marks
+        ((CAST((0, geom,
+            datsta, datend, persta, perend, objnam, nobjnm, inform, ninfom,
+            scamin, picrep, txtdsc, sordat, sorind, colour, colpat, condtn,
+            bcnshp, catlam, dirimp) AS fairway_marks)
+        ))
 ;