Mercurial > gemma
diff schema/gemma_tests.sql @ 4118:b785b6bef578
Adapted db tests to new historization-implementation.
Additional test for the histoprization features and constraints would
be nice... But for now at least the existing ones run without errors...
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 31 Jul 2019 18:33:49 +0200 |
parents | db87f34805fb |
children | 9fef9930aa8a |
line wrap: on
line diff
--- a/schema/gemma_tests.sql Wed Jul 31 18:26:02 2019 +0200 +++ b/schema/gemma_tests.sql Wed Jul 31 18:33:49 2019 +0200 @@ -30,40 +30,3 @@ $$, 23505, NULL, 'No duplicate geometries can be inserted into waterway_area'); - -START TRANSACTION; -CREATE TEMP TABLE new_v (v) AS - SELECT tstzrange(current_timestamp - '2 d'::interval, - current_timestamp - '12 h'::interval); -INSERT INTO waterway.gauges ( - location, - validity, - objname, - geom, - zero_point, - date_info, - source_organization, - lastupdate, - erased) -VALUES ( - ('AT', 'XXX', '00001', 'G0001', 1)::isrs, - (SELECT v FROM new_v), - 'testgauge', - ST_geomfromtext('POINT(0 0)', 4326), - 0, - current_timestamp, - 'testorganization', - current_timestamp, - true); --- Fix validity of old entry to match exclusion constraint -UPDATE waterway.gauges SET - validity = validity - (SELECT v FROM new_v) -WHERE location = ('AT', 'XXX', '00001', 'G0001', 1)::isrs - AND validity && (SELECT v FROM new_v) - AND NOT erased; -COMMIT; -SELECT results_eq($$ - SELECT count(*) FROM waterway.bottlenecks GROUP BY bottleneck_id; - $$, - CAST(ARRAY[2,2] AS bigint[]), - 'Bottlenecks have been split to two new matching gauge versions');