Permalink
Browse files

fixed table swapping with custom indices

  • Loading branch information...
1 parent 40d6d22 commit 172593faf17c806eae374dcf971d5b1a7ab7655d @olt olt committed Aug 16, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 imposm/db/postgis.py
View
4 imposm/db/postgis.py
@@ -277,7 +277,7 @@ def swap_tables(self, new_prefix, existing_prefix, backup_prefix):
cur.execute('ALTER TABLE "%s" RENAME TO "%s"' % (table_name, rename_to))
for idx in existing_indexes:
- if idx in (table_name + '_geom', table_name + '_pkey') or idx.startswith(table_name + '_trgm_idx_'):
+ if idx in (table_name + '_geom', table_name + '_pkey') or idx.startswith(table_name + '_trgm_idx_') or idx.startswith(table_name + '_idx_'):
new_idx = idx.replace(table_name, rename_to, 1)
cur.execute('ALTER INDEX "%s" RENAME TO "%s"' % (idx, new_idx))
if table_name + '_id_seq' in existing_seq:
@@ -291,7 +291,7 @@ def swap_tables(self, new_prefix, existing_prefix, backup_prefix):
cur.execute('ALTER TABLE "%s" RENAME TO "%s"' % (table_name, rename_to))
for idx in new_indexes:
- if idx in (table_name + '_geom', table_name + '_pkey') or idx.startswith(table_name + '_trgm_idx_'):
+ if idx in (table_name + '_geom', table_name + '_pkey') or idx.startswith(table_name + '_trgm_idx_') or idx.startswith(table_name + '_idx_'):
new_idx = idx.replace(table_name, rename_to, 1)
cur.execute('ALTER INDEX "%s" RENAME TO "%s"' % (idx, new_idx))
if table_name + '_id_seq' in new_seq:

0 comments on commit 172593f

Please sign in to comment.