From 9dfa61eee1fd599ea7058b9fc911dc595eeb6667 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Wed, 3 Apr 2024 19:54:56 +0200 Subject: [PATCH 1/2] Replace add_row() by insert() in tests As preparation for the removal of the add_row() function. --- tests/data/test_output_flex.lua | 44 +++++++++++-------- tests/data/test_output_flex_copy.lua | 44 +++++++++++-------- tests/data/test_output_flex_stage2.lua | 12 +++--- tests/data/test_output_flex_stage2_alt.lua | 8 ++-- tests/data/test_output_flex_uni.lua | 50 +++++++++++----------- tests/data/test_output_flex_validgeom.lua | 13 +++--- tests/data/test_output_flex_way.lua | 18 ++++---- 7 files changed, 105 insertions(+), 84 deletions(-) diff --git a/tests/data/test_output_flex.lua b/tests/data/test_output_flex.lua index c25469168..175c77900 100644 --- a/tests/data/test_output_flex.lua +++ b/tests/data/test_output_flex.lua @@ -3,7 +3,7 @@ local tables = {} tables.point = osm2pgsql.define_node_table('osm2pgsql_test_point', { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'point' }, + { column = 'geom', type = 'point', not_null = true }, }) tables.line = osm2pgsql.define_table{ @@ -12,7 +12,7 @@ tables.line = osm2pgsql.define_table{ columns = { { column = 'tags', type = 'hstore' }, { column = 'name', type = 'text' }, - { column = 'geom', type = 'linestring' }, + { column = 'geom', type = 'linestring', not_null = true }, }, cluster = 'auto' } @@ -23,8 +23,8 @@ tables.polygon = osm2pgsql.define_table{ columns = { { column = 'tags', type = 'hstore' }, { column = 'name', type = 'text' }, - { column = 'geom', type = 'geometry' }, - { column = 'area', type = 'area' }, + { column = 'geom', type = 'geometry', not_null = true }, + { column = 'area', type = 'real' }, } } @@ -33,7 +33,7 @@ tables.route = osm2pgsql.define_table{ ids = { type = 'relation', id_column = 'osm_id' }, columns = { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'multilinestring' }, + { column = 'geom', type = 'multilinestring', not_null = true }, } } @@ -85,8 +85,9 @@ function osm2pgsql.process_node(object) return end - tables.point:add_row({ - tags = object.tags + tables.point:insert({ + tags = object.tags, + geom = object:as_point() }) end @@ -96,15 +97,18 @@ function osm2pgsql.process_way(object) end if is_polygon(object.tags) then - tables.polygon:add_row({ + local geom = object:as_polygon() + tables.polygon:insert({ tags = object.tags, name = object.tags.name, - geom = { create = 'area' } + geom = geom, + area = geom:area() }) else - tables.line:add_row({ + tables.line:insert({ tags = object.tags, - name = object.tags.name + name = object.tags.name, + geom = object:as_linestring() }) end end @@ -115,18 +119,22 @@ function osm2pgsql.process_relation(object) end if object.tags.type == 'multipolygon' or object.tags.type == 'boundary' then - tables.polygon:add_row({ - tags = object.tags, - name = object.tags.name, - geom = { create = 'area', split_at = 'multi' } - }) + local mgeom = object:as_multipolygon() + for sgeom in mgeom:geometries() do + tables.polygon:insert({ + tags = object.tags, + name = object.tags.name, + geom = sgeom, + area = sgeom:area() + }) + end return end if object.tags.type == 'route' then - tables.route:add_row({ + tables.route:insert({ tags = object.tags, - geom = { create = 'line' } + geom = object:as_multilinestring() }) end end diff --git a/tests/data/test_output_flex_copy.lua b/tests/data/test_output_flex_copy.lua index c25469168..175c77900 100644 --- a/tests/data/test_output_flex_copy.lua +++ b/tests/data/test_output_flex_copy.lua @@ -3,7 +3,7 @@ local tables = {} tables.point = osm2pgsql.define_node_table('osm2pgsql_test_point', { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'point' }, + { column = 'geom', type = 'point', not_null = true }, }) tables.line = osm2pgsql.define_table{ @@ -12,7 +12,7 @@ tables.line = osm2pgsql.define_table{ columns = { { column = 'tags', type = 'hstore' }, { column = 'name', type = 'text' }, - { column = 'geom', type = 'linestring' }, + { column = 'geom', type = 'linestring', not_null = true }, }, cluster = 'auto' } @@ -23,8 +23,8 @@ tables.polygon = osm2pgsql.define_table{ columns = { { column = 'tags', type = 'hstore' }, { column = 'name', type = 'text' }, - { column = 'geom', type = 'geometry' }, - { column = 'area', type = 'area' }, + { column = 'geom', type = 'geometry', not_null = true }, + { column = 'area', type = 'real' }, } } @@ -33,7 +33,7 @@ tables.route = osm2pgsql.define_table{ ids = { type = 'relation', id_column = 'osm_id' }, columns = { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'multilinestring' }, + { column = 'geom', type = 'multilinestring', not_null = true }, } } @@ -85,8 +85,9 @@ function osm2pgsql.process_node(object) return end - tables.point:add_row({ - tags = object.tags + tables.point:insert({ + tags = object.tags, + geom = object:as_point() }) end @@ -96,15 +97,18 @@ function osm2pgsql.process_way(object) end if is_polygon(object.tags) then - tables.polygon:add_row({ + local geom = object:as_polygon() + tables.polygon:insert({ tags = object.tags, name = object.tags.name, - geom = { create = 'area' } + geom = geom, + area = geom:area() }) else - tables.line:add_row({ + tables.line:insert({ tags = object.tags, - name = object.tags.name + name = object.tags.name, + geom = object:as_linestring() }) end end @@ -115,18 +119,22 @@ function osm2pgsql.process_relation(object) end if object.tags.type == 'multipolygon' or object.tags.type == 'boundary' then - tables.polygon:add_row({ - tags = object.tags, - name = object.tags.name, - geom = { create = 'area', split_at = 'multi' } - }) + local mgeom = object:as_multipolygon() + for sgeom in mgeom:geometries() do + tables.polygon:insert({ + tags = object.tags, + name = object.tags.name, + geom = sgeom, + area = sgeom:area() + }) + end return end if object.tags.type == 'route' then - tables.route:add_row({ + tables.route:insert({ tags = object.tags, - geom = { create = 'line' } + geom = object:as_multilinestring() }) end end diff --git a/tests/data/test_output_flex_stage2.lua b/tests/data/test_output_flex_stage2.lua index 3c129b7ba..9c55e3866 100644 --- a/tests/data/test_output_flex_stage2.lua +++ b/tests/data/test_output_flex_stage2.lua @@ -7,7 +7,7 @@ tables.highways = osm2pgsql.define_table{ columns = { { column = 'tags', type = 'hstore' }, { column = 'refs', type = 'text' }, - { column = 'geom', type = 'linestring', projection = 4326 }, + { column = 'geom', type = 'linestring', projection = 4326, not_null = true }, } } @@ -17,7 +17,7 @@ tables.routes = osm2pgsql.define_table{ columns = { { column = 'tags', type = 'hstore' }, { column = 'members', type = 'text' }, - { column = 'geom', type = 'multilinestring', projection = 4326 }, + { column = 'geom', type = 'multilinestring', projection = 4326, not_null = true }, } } @@ -26,7 +26,7 @@ local w2r = {} function osm2pgsql.process_way(object) local row = { tags = object.tags, - geom = { create = 'line' } + geom = object:as_linestring() } local d = w2r[object.id] @@ -40,7 +40,7 @@ function osm2pgsql.process_way(object) row.refs = table.concat(refs, ',') end - tables.highways:add_row(row) + tables.highways:insert(row) end function osm2pgsql.select_relation_members(relation) @@ -65,10 +65,10 @@ function osm2pgsql.process_relation(object) end end - tables.routes:add_row({ + tables.routes:insert({ tags = object.tags, members = table.concat(mlist, ','), - geom = { create = 'line' } + geom = object:as_multilinestring() }) end diff --git a/tests/data/test_output_flex_stage2_alt.lua b/tests/data/test_output_flex_stage2_alt.lua index 79d46dac8..6eedb9ac1 100644 --- a/tests/data/test_output_flex_stage2_alt.lua +++ b/tests/data/test_output_flex_stage2_alt.lua @@ -30,7 +30,7 @@ function osm2pgsql.process_way(object) local row = { tags = object.tags, - geom = { create = 'line' } + geom = object:as_linestring() } local d = w2r[object.id] @@ -44,7 +44,7 @@ function osm2pgsql.process_way(object) row.refs = table.concat(refs, ',') end - tables.highways:add_row(row) + tables.highways:insert(row) end function osm2pgsql.select_relation_members(relation) @@ -69,10 +69,10 @@ function osm2pgsql.process_relation(object) end end - tables.routes:add_row({ + tables.routes:insert({ tags = object.tags, members = table.concat(mlist, ','), - geom = { create = 'line' } + geom = object:as_multilinestring() }) end diff --git a/tests/data/test_output_flex_uni.lua b/tests/data/test_output_flex_uni.lua index db58a8d22..2e4aaaa04 100644 --- a/tests/data/test_output_flex_uni.lua +++ b/tests/data/test_output_flex_uni.lua @@ -6,7 +6,7 @@ local table1idcol = osm2pgsql.define_table{ columns = { { column = 'orig_id', type = 'int8' }, { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'geometry' }, + { column = 'geom', type = 'geometry', not_null = true }, } } @@ -16,7 +16,7 @@ local table2idcol = osm2pgsql.define_table{ ids = { type = 'any', type_column = 'x_type', id_column = 'x_id' }, columns = { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'geometry' }, + { column = 'geom', type = 'geometry', not_null = true }, } } @@ -29,14 +29,14 @@ function osm2pgsql.process_node(object) return end - table1idcol:add_row({ + table1idcol:insert({ orig_id = object.id, tags = object.tags, - geom = { create = 'point' } + geom = object:as_point() }) - table2idcol:add_row({ + table2idcol:insert({ tags = object.tags, - geom = { create = 'point' } + geom = object:as_point() }) end @@ -46,40 +46,42 @@ function osm2pgsql.process_way(object) end if object.tags.building then - table1idcol:add_row({ + table1idcol:insert({ orig_id = object.id, tags = object.tags, - geom = { create = 'area' } + geom = object:as_polygon() }) - table2idcol:add_row({ + table2idcol:insert({ tags = object.tags, - geom = { create = 'area' } + geom = object:as_polygon() }) else - table1idcol:add_row({ + table1idcol:insert({ orig_id = object.id, tags = object.tags, - geom = { create = 'line' } + geom = object:as_linestring() }) - table2idcol:add_row({ + table2idcol:insert({ tags = object.tags, - geom = { create = 'line' } + geom = object:as_linestring() }) end end function osm2pgsql.process_relation(object) if object.tags.type == 'multipolygon' then - table1idcol:add_row({ - orig_id = object.id, - tags = object.tags, - geom = { create = 'area', split_at = 'multi' } - }) - table2idcol:add_row({ - tags = object.tags, - geom = { create = 'area', split_at = 'multi' } - }) - return + local mgeom = object:as_multipolygon() + for sgeom in mgeom:geometries() do + table1idcol:insert({ + orig_id = object.id, + tags = object.tags, + geom = sgeom + }) + table2idcol:insert({ + tags = object.tags, + geom = sgeom + }) + end end end diff --git a/tests/data/test_output_flex_validgeom.lua b/tests/data/test_output_flex_validgeom.lua index abb2a789f..afdd8944b 100644 --- a/tests/data/test_output_flex_validgeom.lua +++ b/tests/data/test_output_flex_validgeom.lua @@ -16,14 +16,17 @@ function osm2pgsql.process_way(object) return end - polygons:add_row({ - geom = { create = 'area' } + polygons:insert({ + geom = object:as_polygon() }) end function osm2pgsql.process_relation(object) - polygons:add_row({ - geom = { create = 'area', split_at='multi' } - }) + local mgeom = object:as_multipolygon() + for sgeom in mgeom:geometries() do + polygons:insert({ + geom = sgeom + }) + end end diff --git a/tests/data/test_output_flex_way.lua b/tests/data/test_output_flex_way.lua index 24e7b3d47..873e7c983 100644 --- a/tests/data/test_output_flex_way.lua +++ b/tests/data/test_output_flex_way.lua @@ -3,19 +3,19 @@ local tables = {} tables.t1 = osm2pgsql.define_way_table('osm2pgsql_test_t1', { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'linestring' }, + { column = 'geom', type = 'linestring', not_null = true }, }) tables.t2 = osm2pgsql.define_way_table('osm2pgsql_test_t2', { { column = 'tags', type = 'hstore' }, { column = 'rel_ids', type = 'text' }, - { column = 'geom', type = 'linestring' }, + { column = 'geom', type = 'linestring', not_null = true }, }) tables.tboth = osm2pgsql.define_way_table('osm2pgsql_test_tboth', { { column = 'tags', type = 'hstore' }, { column = 'rel_ids', type = 'text' }, - { column = 'geom', type = 'linestring' }, + { column = 'geom', type = 'linestring', not_null = true }, }) local w2r = {} @@ -33,28 +33,28 @@ end function osm2pgsql.process_way(object) if object.tags.t1 then - tables.t1:add_row{ + tables.t1:insert{ tags = object.tags, - geom = { create = 'line' } + geom = object:as_linestring() } end if osm2pgsql.stage == 2 and object.tags.t2 then local ids = get_ids(w2r[object.id]) if ids then - tables.t2:add_row{ + tables.t2:insert{ rel_ids = ids, - geom = { create = 'line' } + geom = object:as_linestring() } end end if object.tags.tboth then local ids = get_ids(w2r[object.id]) - tables.tboth:add_row{ + tables.tboth:insert{ tags = object.tags, rel_ids = ids, - geom = { create = 'line' } + geom = object:as_linestring() } end end From 7acb80c8cdb8d6fc09c7919c486ffcdbff2a5f8d Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Wed, 3 Apr 2024 21:32:30 +0200 Subject: [PATCH 2/2] Replace add_row() by insert() in BDD tests As preparation for the removal of the add_row() function. --- tests/bdd/flex/area.feature | 19 ++++++---- tests/bdd/flex/bbox.feature | 21 ++++++----- tests/bdd/flex/extra-attributes.feature | 6 ++-- tests/bdd/flex/invalid-geometries.feature | 24 +++++++------ tests/bdd/flex/line-splitting.feature | 18 +++++----- tests/bdd/flex/multigeom.feature | 44 ++++++++++++----------- tests/bdd/flex/nocluster.feature | 7 ++-- tests/bdd/flex/nogeom.feature | 2 +- tests/bdd/flex/relation-changes.feature | 6 ++-- 9 files changed, 83 insertions(+), 64 deletions(-) diff --git a/tests/bdd/flex/area.feature b/tests/bdd/flex/area.feature index 27f952263..bc6d7a5ba 100644 --- a/tests/bdd/flex/area.feature +++ b/tests/bdd/flex/area.feature @@ -21,22 +21,27 @@ Feature: Tests for area column type columns = { { column = 'name', type = 'text' }, { column = 'geom', type = 'geometry', projection = }, - { column = 'area', type = 'area', projection = }, + { column = 'area', type = 'real' }, } } function osm2pgsql.process_way(object) - polygons:add_row({ + local geom = object:as_polygon() + polygons:insert({ name = object.tags.name, - geom = { create = 'area' } + geom = geom, + area = geom:transform():area() }) end function osm2pgsql.process_relation(object) - polygons:add_row({ - name = object.tags.name, - geom = { create = 'area', split_at = 'multi' } - }) + for sgeom in object:as_multipolygon():geometries() do + polygons:insert({ + name = object.tags.name, + geom = sgeom, + area = sgeom:transform():area() + }) + end end """ When running osm2pgsql flex diff --git a/tests/bdd/flex/bbox.feature b/tests/bdd/flex/bbox.feature index 485e7d674..8c50fbc6f 100644 --- a/tests/bdd/flex/bbox.feature +++ b/tests/bdd/flex/bbox.feature @@ -12,13 +12,13 @@ Feature: Test get_bbox() function { column = 'min_y', type = 'real' }, { column = 'max_x', type = 'real' }, { column = 'max_y', type = 'real' }, - { column = 'geom', type = 'point', projection = }, + { column = 'geom', type = 'point', projection = , not_null = true }, }) function osm2pgsql.process_node(object) - local row = {} + local row = { geom = object:as_point() } row.min_x, row.min_y, row.max_x, row.max_y = object:get_bbox() - points:add_row(row) + points:insert(row) end """ When running osm2pgsql flex @@ -47,13 +47,13 @@ Feature: Test get_bbox() function { column = 'min_y', type = 'real' }, { column = 'max_x', type = 'real' }, { column = 'max_y', type = 'real' }, - { column = 'geom', type = 'linestring', projection = }, + { column = 'geom', type = 'linestring', projection = , not_null = true }, }) function osm2pgsql.process_way(object) - local row = { geom = { create = 'line' } } + local row = { geom = object:as_linestring() } row.min_x, row.min_y, row.max_x, row.max_y = object:get_bbox() - highways:add_row(row) + highways:insert(row) end """ When running osm2pgsql flex @@ -85,13 +85,16 @@ Feature: Test get_bbox() function { column = 'min_y', type = 'real' }, { column = 'max_x', type = 'real' }, { column = 'max_y', type = 'real' }, - { column = 'geom', type = 'linestring', projection = }, + { column = 'geom', type = 'linestring', projection = , not_null = true }, }) function osm2pgsql.process_relation(object) - local row = { geom = { create = 'line' } } + local row = {} row.min_x, row.min_y, row.max_x, row.max_y = object:get_bbox() - rels:add_row(row) + for sgeom in object:as_multilinestring():line_merge():geometries() do + row.geom = sgeom + rels:insert(row) + end end """ When running osm2pgsql flex diff --git a/tests/bdd/flex/extra-attributes.feature b/tests/bdd/flex/extra-attributes.feature index b299a8d2e..d885dbbe2 100644 --- a/tests/bdd/flex/extra-attributes.feature +++ b/tests/bdd/flex/extra-attributes.feature @@ -14,13 +14,13 @@ Feature: Tests for including extra attributes { column = 'timestamp', type = 'int4' }, { column = 'uid', type = 'int4' }, { column = 'user', type = 'text' }, - { column = 'geom', type = 'linestring' }, + { column = 'geom', type = 'linestring', not_null = true }, } } function osm2pgsql.process_way(object) - object.geom = { create = 'line' } - attr_table:add_row(object) + object.geom = object:as_linestring() + attr_table:insert(object) end """ diff --git a/tests/bdd/flex/invalid-geometries.feature b/tests/bdd/flex/invalid-geometries.feature index 3ed9b6641..c9c47421d 100644 --- a/tests/bdd/flex/invalid-geometries.feature +++ b/tests/bdd/flex/invalid-geometries.feature @@ -10,7 +10,7 @@ Feature: Test handling of invalid geometries ids = { type = 'way', id_column = 'osm_id' }, columns = { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'linestring', projection = 4326 }, + { column = 'geom', type = 'linestring', projection = 4326, not_null = true }, } } @@ -19,28 +19,32 @@ Feature: Test handling of invalid geometries ids = { type = 'area', id_column = 'osm_id' }, columns = { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'geometry', projection = 4326 } + { column = 'geom', type = 'geometry', projection = 4326, not_null = true } } } function osm2pgsql.process_way(object) if object.tags.natural then - tables.polygon:add_row({ + tables.polygon:insert({ tags = object.tags, - geom = { create = 'area' } + geom = object:as_polygon() }) else - tables.line:add_row({ - tags = object.tags + tables.line:insert({ + tags = object.tags, + geom = object:as_linestring() }) end end function osm2pgsql.process_relation(object) - tables.polygon:add_row({ - tags = object.tags, - geom = { create = 'area', split_at = 'multi' } - }) + local mgeom = object:as_multipolygon() + for sgeom in mgeom:geometries() do + tables.polygon:insert({ + tags = object.tags, + geom = sgeom + }) + end end """ diff --git a/tests/bdd/flex/line-splitting.feature b/tests/bdd/flex/line-splitting.feature index 4ed2debf9..48fdfdcae 100644 --- a/tests/bdd/flex/line-splitting.feature +++ b/tests/bdd/flex/line-splitting.feature @@ -7,23 +7,25 @@ Feature: Test splitting of lines tables.line = osm2pgsql.define_way_table('osm2pgsql_test_line', { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'linestring', projection = 4326 } + { column = 'geom', type = 'linestring', projection = 4326, not_null = true } }) tables.split = osm2pgsql.define_way_table('osm2pgsql_test_split', { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'linestring', projection = 4326 } + { column = 'geom', type = 'linestring', projection = 4326, not_null = true } }) function osm2pgsql.process_way(object) - tables.line:add_row({ + tables.line:insert({ tags = object.tags, - geom = { create = 'line' } - }) - tables.split:add_row({ - tags = object.tags, - geom = { create = 'line', split_at = 1.0 } + geom = object:as_linestring() }) + for sgeom in object:as_linestring():segmentize(1.0):geometries() do + tables.split:insert({ + tags = object.tags, + geom = sgeom + }) + end end """ diff --git a/tests/bdd/flex/multigeom.feature b/tests/bdd/flex/multigeom.feature index 944990e65..c5083729d 100644 --- a/tests/bdd/flex/multigeom.feature +++ b/tests/bdd/flex/multigeom.feature @@ -26,16 +26,16 @@ Feature: Handling of multiple geometries } function osm2pgsql.process_way(object) - polygons:add_row({ + polygons:insert({ name = object.tags.name, - geom = { create = 'area' } + geom = object:as_polygon() }) end function osm2pgsql.process_relation(object) - polygons:add_row({ + polygons:insert({ name = object.tags.name, - geom = { create = 'area' } + geom = object:as_multipolygon() }) end """ @@ -61,17 +61,19 @@ Feature: Handling of multiple geometries } function osm2pgsql.process_way(object) - polygons:add_row({ + polygons:insert({ name = object.tags.name, - geom = { create = 'area' } + geom = object:as_polygon() }) end function osm2pgsql.process_relation(object) - polygons:add_row({ - name = object.tags.name, - geom = { create = 'area', split_at = 'multi' } - }) + for sgeom in object:as_multipolygon():geometries() do + polygons:insert({ + name = object.tags.name, + geom = sgeom + }) + end end """ When running osm2pgsql flex @@ -102,16 +104,16 @@ Feature: Handling of multiple geometries } function osm2pgsql.process_way(object) - polygons:add_row({ + polygons:insert({ name = object.tags.name, - geom = { create = 'area' } + geom = object:as_polygon() }) end function osm2pgsql.process_relation(object) - polygons:add_row({ + polygons:insert({ name = object.tags.name, - geom = { create = 'area' } + geom = object:as_multipolygon() }) end """ @@ -137,17 +139,19 @@ Feature: Handling of multiple geometries } function osm2pgsql.process_way(object) - polygons:add_row({ + polygons:insert({ name = object.tags.name, - geom = { create = 'area' } + geom = object:as_polygon() }) end function osm2pgsql.process_relation(object) - polygons:add_row({ - name = object.tags.name, - geom = { create = 'area', split_at = 'multi' } - }) + for sgeom in object:as_multipolygon():geometries() do + polygons:insert({ + name = object.tags.name, + geom = sgeom + }) + end end """ When running osm2pgsql flex diff --git a/tests/bdd/flex/nocluster.feature b/tests/bdd/flex/nocluster.feature index 3cfdcc982..0d99853a6 100644 --- a/tests/bdd/flex/nocluster.feature +++ b/tests/bdd/flex/nocluster.feature @@ -7,12 +7,13 @@ Feature: Test flex config without clustering """ local dtable = osm2pgsql.define_node_table('osm2pgsql_test_point', { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'point' }, + { column = 'geom', type = 'point', not_null = true }, }, { cluster = 'no' }) function osm2pgsql.process_node(data) - dtable:add_row({ - tags = data.tags + dtable:insert({ + tags = data.tags, + geom = data:as_point() }) end """ diff --git a/tests/bdd/flex/nogeom.feature b/tests/bdd/flex/nogeom.feature index 5c3a2338a..d5f313bf3 100644 --- a/tests/bdd/flex/nogeom.feature +++ b/tests/bdd/flex/nogeom.feature @@ -13,7 +13,7 @@ Feature: Handling of tables without geometry }) function osm2pgsql.process_node(object) - pois:add_row{ tags = object.tags } + pois:insert{ tags = object.tags } end """ When running osm2pgsql flex with parameters diff --git a/tests/bdd/flex/relation-changes.feature b/tests/bdd/flex/relation-changes.feature index 3ab06983d..a05c469e7 100644 --- a/tests/bdd/flex/relation-changes.feature +++ b/tests/bdd/flex/relation-changes.feature @@ -5,14 +5,14 @@ Feature: Handling changes to relations """ local rel_table = osm2pgsql.define_area_table('osm2pgsql_test_relations', { { column = 'tags', type = 'hstore' }, - { column = 'geom', type = 'geometry' } + { column = 'geom', type = 'geometry', not_null = true } }) function osm2pgsql.process_relation(object) if object.tags.type == 'multipolygon' then - rel_table:add_row{ + rel_table:insert{ tags = object.tags, - geom = { create = 'area' } + geom = object:as_multipolygon() } end end