# HG changeset patch # User Sascha Wilde # Date 1564676612 -7200 # Node ID 980f12d3c76615fb2083cf1981d86e7e75702775 # Parent 24c5eec22c2df3f66781720bd0fad9cfb0b71f5f bottleneck import: Fixed detection of identical bottlenecks. diff -r 24c5eec22c2d -r 980f12d3c766 pkg/imports/bn.go --- a/pkg/imports/bn.go Thu Aug 01 17:28:35 2019 +0200 +++ b/pkg/imports/bn.go Thu Aug 01 18:23:32 2019 +0200 @@ -90,24 +90,23 @@ RETURNING id ` + // We only check for NOT NULL values, for correct compairison with + // values, which might be null (and then muyst not be compairt with `=' + // but with `IS NULL' is comlicated and that we are checking more than + // only (bottleneck_id, validity, date_info) is luxury already. findExactMatchBottleneckSQL = ` WITH -bounds (b) AS (VALUES (isrs_fromText($6)), (isrs_fromText($7))), +bounds (b) AS (VALUES (isrs_fromText($4)), (isrs_fromText($5))), r AS (SELECT isrsrange( - (SELECT b FROM bounds ORDER BY b USING <~ FETCH FIRST ROW ONLY), - (SELECT b FROM bounds ORDER BY b USING >~ FETCH FIRST ROW ONLY)) AS r) + (SELECT b FROM bounds ORDER BY b USING <~ FETCH FIRST ROW ONLY), + (SELECT b FROM bounds ORDER BY b USING >~ FETCH FIRST ROW ONLY)) AS r) SELECT id FROM waterway.bottlenecks WHERE ( bottleneck_id, validity, gauge_location, - objnam, - nobjnm, stretch, - rb, - lb, responsible_country, - revisiting_time, limiting, date_info, source_organization, @@ -116,16 +115,11 @@ $1, $2::tstzrange, isrs_fromText($3), - $4, - $5, (SELECT r FROM r), - $8, + $6, + $7, + $8::timestamptz, $9, - $10, - $11::smallint, - $12, - $13::timestamptz, - $14, true ) ` @@ -465,13 +459,8 @@ bn.Bottleneck_id, &validity, bn.Fk_g_fid, - bn.OBJNAM, - bn.NOBJNM, bn.From_ISRS, bn.To_ISRS, - rb, - lb, country, - revisitingTime, limiting, bn.Date_Info, bn.Source,