[Tile-serving] [openstreetmap/osm2pgsql] Flex output is trying to create ID index on tables without IDs (#1507)
rouen-sk
notifications at github.com
Wed May 19 09:16:39 UTC 2021
Hey,
For my use case I need tables `way_nodes` and `relation_members`, similar to those created by osmosis tool.
It is no problem to create them in osm2pgsql:
```
tables.way_nodes = osm2pgsql.define_table({
name = 'way_nodes',
columns = {
{ column = 'way_id', type = 'bigint' },
{ column = 'node_id', type = 'bigint' },
{ column = 'sequence_id', type = 'integer' }
}
})
function osm2pgsql.process_way(object)
...
for i,v in ipairs(object.nodes) do
tables.way_nodes:add_row({
way_id = object.id,
node_id = v,
sequence_id = i
})
end
...
end
```
And it works fine. But the import ultimately fails, because osm2pgqsl is trying to create ID index for these tables and creates invalid SQL statement for that (index on no columns):
```
2021-05-19 09:00:18 osm2pgsql version 1.4.2
2021-05-19 09:00:18 Database version: 12.6 (Ubuntu 12.6-1.pgdg18.04+1)
2021-05-19 09:00:18 PostGIS version: 3.1
2021-05-19 09:00:18 Node-cache: cache=4096MB, maxblocks=65536*65536, allocation method=3
2021-05-19 09:00:18 WARNING: Table 'relation_members' doesn't have an 'ids' column. Updates and expire will not work!
2021-05-19 09:00:56 Reading input files done in 38s.
2021-05-19 09:00:56 Processed 24073351 nodes in 8s - 3009k/s
2021-05-19 09:00:56 Processed 3298258 ways in 28s - 118k/s
2021-05-19 09:00:56 Processed 38094 relations in 2s - 19k/s
2021-05-19 09:00:57 Reprocess marked ways (stage 2)...
2021-05-19 09:00:57 Creating id index on table 'ways'...
2021-05-19 09:00:57 Creating id index on table 'relation_members'...
2021-05-19 09:00:57 node cache: stored: 24073351(100.00%), storage efficiency: 51.16% (dense blocks: 520, sparse nodes: 21395955), hit rate: 100.00%
2021-05-19 09:00:58 ERROR: Database error: ERROR: syntax error at or near ")"
LINE 1: CREATE INDEX ON "public"."relation_members" USING BTREE ()
```
Is there a way to do one of these things?
* Define ID with multiple columns for output table? (for example `way_id` and `sequence_id` are composite key for `way_nodes`)
* Make osm2pgsql not creating indexes for these tables without IDs (and I will create them manually afterwards)
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/1507
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210519/a613af27/attachment.htm>
More information about the Tile-serving
mailing list