Skip to content

Commit c114304

Browse files
refined queries
1 parent 56cd0cf commit c114304

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

postgres/scripts/v1_to_v2/copy_projects_from_csv.sql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,9 @@ SET status = 'inactive'
4545
WHERE status = '3';
4646

4747
-- Extract geometry (kml) from info attribute (json) of imports table.
48-
UPDATE v1_imports i1
49-
SET kml = (SELECT info->'info'->>'kml' as kml FROM v1_imports i2 WHERE i1.import_id = i2.import_id);
50-
5148
-- Get only the geometry (Polygone or MultiPolygon) of the kml string.
5249
UPDATE v1_imports
53-
SET kml = substring(kml FROM '<Polygon>.*<\/Polygon>|<MultiPolygon>.*<\/MultiPolygon>');
50+
SET kml = substring(info->'info'->>'kml' FROM '<Polygon>.*<\/Polygon>|<MultiPolygon>.*<\/MultiPolygon>');
5451

5552
UPDATE v1_projects
5653
SET kml = v1_imports.kml

0 commit comments

Comments
 (0)