diff pkg/imports/agm.go @ 2120:817cd8b89a86

Approved gauge measuments import: Give type hints when insertinf/querying isrs location codes.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 05 Feb 2019 12:27:40 +0100
parents 58a28715e386
children b868cb653c4d
line wrap: on
line diff
--- a/pkg/imports/agm.go	Tue Feb 05 11:39:27 2019 +0100
+++ b/pkg/imports/agm.go	Tue Feb 05 12:27:40 2019 +0100
@@ -159,7 +159,7 @@
   source_organization
 FROM waterway.gauge_measurements
 WHERE
-  fk_gauge_id = ($1, $2, $3, $4, $5) AND
+  fk_gauge_id = ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int) AND
   measure_date = $6 AND staging_done`
 
 	agmInsertSQL = `
@@ -180,7 +180,7 @@
   is_waterlevel,
   staging_done
 ) VALUES(
-  ($1, $2, $3, $4, $5),
+  ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int),
   $6,
   $7,
   $8,