changeset 2083:6deafd6f7f86

Fix exclusion constraint for waterway profiles The same validity period can well occur at different locations.
author Tom Gottfried <tom@intevation.de>
date Thu, 31 Jan 2019 12:40:54 +0100
parents b2451f00f57d
children ddbac0f22ffb
files schema/gemma.sql
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/schema/gemma.sql	Thu Jan 31 12:38:39 2019 +0100
+++ b/schema/gemma.sql	Thu Jan 31 12:40:54 2019 +0100
@@ -18,6 +18,8 @@
 -- Infrastructure
 --
 CREATE EXTENSION postgis;
+-- needed for multi-column GiST indexes with otherwise unsupported types:
+CREATE EXTENSION btree_gist;
 
 -- TODO: will there ever be UPDATEs or can we drop that function due to
 -- historicisation?
@@ -397,7 +399,7 @@
         id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
         location isrs NOT NULL,
         validity tstzrange,
-        EXCLUDE USING GIST (validity WITH &&),
+        EXCLUDE USING GIST (isrs_asText(location) WITH =, validity WITH &&),
         lnwl double precision,
         mwl double precision,
         hnwl double precision,