From f838f0378a8f7c0325f84a6e053c32043cc53d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 25 Mar 2021 09:57:25 +0200 Subject: [PATCH] log sql statements --- IV/db | 3 ++- IV/wm.sql | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/IV/db b/IV/db index 8f17bdd..fc596a2 100755 --- a/IV/db +++ b/IV/db @@ -35,7 +35,8 @@ case ${1:-} in -e POSTGRES_USER=osm \ -e POSTGRES_PASSWORD=osm \ --name "$name" \ - postgis/postgis:13-3.1-alpine + postgis/postgis:13-3.1-alpine \ + -c log_statement=all _wait_for_postgres ;; stop) diff --git a/IV/wm.sql b/IV/wm.sql index 2f1873c..048bad4 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -311,6 +311,7 @@ declare i integer; line geometry; lines geometry[]; + bend geometry; bends geometry[]; mutated boolean; l_type text; @@ -324,15 +325,18 @@ begin raise 'Unsupported geometry type %', l_type; end if; + i = 1; - mutated = true; foreach line in array lines loop + mutated = true; while mutated loop execute format('create table if not exists integ_%safigures (way geometry)', i); -- if anyone has suggestions how to insert a variable to a table without -- such hackery, I'll be glad to know execute format('insert into integ_%safigures select $1;', i) using (select unnest(array[line])); + raise notice 'inserting: %', st_astext(unnest(array[line])); bends = detect_bends(line); + execute format('create table if not exists integ_%sbbends (i bigint, way geometry)', i); execute format('insert into integ_%sbbends (i, way) select generate_subscripts($1, 1), unnest($1)', i) using bends; bends = fix_gentle_inflections(bends); @@ -342,8 +346,8 @@ begin execute format('create table if not exists integ_%sdselfcrossing (i bigint, way geometry)', i); execute format('insert into integ_%sdselfcrossing (i, way) select generate_subscripts($1, 1), unnest($1)', i) using bends; line = st_linemerge(st_union(bends)); - i = i + 1; end loop; + i = i + 1; end loop; if l_type = 'ST_LineString' then