Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix osm2pgsql index statement creation #4757

Merged

Conversation

cklein05
Copy link
Contributor

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 as None (should be 'way'):

CREATE INDEX planet_osm_point_index ON planet_osm_point USING GIST (None);

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.

CREATE INDEX planet_osm_point_way_idx ON planet_osm_point USING GIST (way);

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:

  • specify 'way' as the target field for osm2pgsql indexes
  • rename osm2pgsql indexes to '<table_name>_way_idx' (as created by osm2pgsql)

Test rendering with links to the example places:

  • no impact on rendering

- specify 'way' as the target field for osm2pgsql indexes
- rename osm2pgsql indexes to '<table_name>_way_idx' (as created by osm2pgsql)
@pnorman pnorman self-requested a review December 29, 2022 10:38
@pnorman pnorman merged commit ab14be3 into gravitystorm:master Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants