log sql statements

This commit is contained in:
Motiejus Jakštys 2021-03-25 09:57:25 +02:00
parent 5788eaf7c1
commit f838f0378a
2 changed files with 8 additions and 3 deletions

3
IV/db
View File

@ -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)

View File

@ -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