From 45972811e33b71efdcc3c32422166a1592ea8b6a Mon Sep 17 00:00:00 2001 From: Itz-Agasta Date: Sat, 31 Jan 2026 22:50:18 +0530 Subject: [PATCH] Preserve import error tables during freeze - Remove 'import_polygon_%' from UPDATE_TABLES to keep import_polygon_error and import_polygon_delete tables in frozen databases. - These tables contain permanent import error tracking data and should not be deleted during freeze. The ro-access grant system expects them to exist in all database states. --- lib-sql/grants.sql | 14 ++++++++------ src/nominatim_db/tools/freeze.py | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib-sql/grants.sql b/lib-sql/grants.sql index e7ce878d..58e41061 100644 --- a/lib-sql/grants.sql +++ b/lib-sql/grants.sql @@ -15,7 +15,6 @@ GRANT SELECT ON nominatim_properties TO "{{config.DATABASE_WEBUSER}}"; -- Location tables GRANT SELECT ON location_property_tiger TO "{{config.DATABASE_WEBUSER}}"; GRANT SELECT ON location_property_osmline TO "{{config.DATABASE_WEBUSER}}"; -GRANT SELECT ON location_area TO "{{config.DATABASE_WEBUSER}}"; GRANT SELECT ON location_postcodes TO "{{config.DATABASE_WEBUSER}}"; -- Search tables @@ -28,10 +27,6 @@ GRANT SELECT ON placex TO "{{config.DATABASE_WEBUSER}}"; GRANT SELECT ON place_addressline TO "{{config.DATABASE_WEBUSER}}"; GRANT SELECT ON placex_entrance TO "{{config.DATABASE_WEBUSER}}"; --- OSM data tables -GRANT SELECT ON planet_osm_ways TO "{{config.DATABASE_WEBUSER}}"; -GRANT SELECT ON planet_osm_rels TO "{{config.DATABASE_WEBUSER}}"; - -- Error/delete tracking tables GRANT SELECT ON import_polygon_error TO "{{config.DATABASE_WEBUSER}}"; GRANT SELECT ON import_polygon_delete TO "{{config.DATABASE_WEBUSER}}"; @@ -42,4 +37,11 @@ GRANT SELECT ON country_osm_grid TO "{{config.DATABASE_WEBUSER}}"; -- Tokenizer tables (word table) {% if 'word' in db.tables %} GRANT SELECT ON word TO "{{config.DATABASE_WEBUSER}}"; -{% endif %} \ No newline at end of file +{% endif %} + +-- Special phrase tables +{% for table in db.tables %} +{% if table.startswith('place_classtype_') %} +GRANT SELECT ON {{ table }} TO "{{config.DATABASE_WEBUSER}}"; +{% endif %} +{% endfor %} \ No newline at end of file diff --git a/src/nominatim_db/tools/freeze.py b/src/nominatim_db/tools/freeze.py index 92bcc748..32d707e1 100644 --- a/src/nominatim_db/tools/freeze.py +++ b/src/nominatim_db/tools/freeze.py @@ -18,7 +18,6 @@ UPDATE_TABLES = [ 'address_levels', 'gb_postcode', 'import_osmosis_log', - 'import_polygon_%', 'location_area%', 'location_road%', 'place',