Mercurial > gemma
view schema/updates/1439/01.add_bn_id_to_bn_overview.sql @ 5560:f2204f91d286
Join the log lines of imports to the log exports to recover data from them.
Used in SR export to extract information that where in the meta json
but now are only found in the log.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 09 Feb 2022 18:34:40 +0100 |
parents | 0b051ee3f238 |
children |
line wrap: on
line source
-- Add bottleneck_id column to bottleneck_overview view. UPDATE sys_admin.published_services SET view_def = $$ SELECT objnam AS name, bn.bottleneck_id, ST_Centroid(area) AS point, (lower(stretch)).hectometre AS from, (upper(stretch)).hectometre AS to, sr.current::text, responsible_country FROM waterway.bottlenecks bn LEFT JOIN ( SELECT bottleneck_id, max(date_info) AS current FROM waterway.sounding_results GROUP BY bottleneck_id) sr ON sr.bottleneck_id = bn.bottleneck_id WHERE bn.validity @> current_timestamp ORDER BY objnam $$ WHERE schema = 'waterway' AND name = 'bottleneck_overview';