forked from 0x2620/pandora
fix findindex in postgresql 10
This commit is contained in:
parent
894a609f3f
commit
302af9cda4
1 changed files with 10 additions and 6 deletions
|
@ -45,8 +45,12 @@ class Command(BaseCommand):
|
||||||
indexes = connection.introspection.get_indexes(cursor, table)
|
indexes = connection.introspection.get_indexes(cursor, table)
|
||||||
drop = []
|
drop = []
|
||||||
if column in indexes:
|
if column in indexes:
|
||||||
sql = "SELECT indexname, indexdef FROM pg_catalog.pg_indexes " + \
|
for sql in (
|
||||||
"WHERE indexdef LIKE '%ON {table}%' AND indexdef LIKE '%{column}%'".format(table=table, column=column)
|
"SELECT indexname, indexdef FROM pg_catalog.pg_indexes " + \
|
||||||
|
"WHERE indexdef LIKE '%ON {table}%' AND indexdef LIKE '%{column}%'".format(table=table, column=column),
|
||||||
|
"SELECT indexname, indexdef FROM pg_catalog.pg_indexes " + \
|
||||||
|
"WHERE indexdef LIKE '%ON public.{table}%' AND indexdef LIKE '%{column}%'".format(table=table, column=column),
|
||||||
|
):
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
for r in cursor:
|
for r in cursor:
|
||||||
if 'USING gin' not in r[1]:
|
if 'USING gin' not in r[1]:
|
||||||
|
|
Loading…
Reference in a new issue