diff pkg/imports/agm.go @ 3389:45a629a3a8b8

Fix constraints on relationship between gauges and measurements/predictions measure_date is the time of measurement, not date_issue. There can be only one measurement at a time for a gauge location, independently of gauge versions with differing validity. The 'measure_date' of a prediction can well be beyond the validity of the gauge, since a new gauge version might appear within the time range of the forecast. There can be only one prediction at a time per date of issue, independently of gauge versions with differing validity.
author Tom Gottfried <tom@intevation.de>
date Wed, 22 May 2019 16:44:13 +0200
parents ec6163c6687d
children 45483dd0d801
line wrap: on
line diff
--- a/pkg/imports/agm.go	Wed May 22 16:30:43 2019 +0200
+++ b/pkg/imports/agm.go	Wed May 22 16:44:13 2019 +0200
@@ -75,7 +75,7 @@
   SELECT o.id AS id
   FROM waterway.gauge_measurements o
   JOIN waterway.gauge_measurements n
-    USING (location, validity, measure_date)
+    USING (location, measure_date)
     WHERE n.id IN (SELECT key FROM staged)
 	  AND o.id NOT IN (SELECT key FROM staged)
 )