Fix osm2pgsql index statement creation #4757
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix osm2pgsql index statement creation
Currently, indexes.py creates syntactically wrong
CREATE INDEX
statements for osm2pgsql indexes (using the--osm2pgsql
option). This is because the target field for the index is specified asNone
(should be'way'
):Additionally, osm2pgsql creates unnamed indexes and so lets the database chooses a meaningful name, which results in
<table_name>_way_idx
. Since re-indexing won't work with unnamed indexes, indexes.py must use a defined index name. However, I recommend using'way_idx'
as the index name for osm2pgsql indexes (instead of'index'
) in order to be in line with osm2pgsql.I've modified indexes.py so that it's emitting
CREATE INDEX
statements of the second type (named'way_idx'
and using'way'
as the target field). If you actually prefer a different index name, feel free to modify my changes after merging.Changes proposed in this pull request:
Test rendering with links to the example places: