lookup name and column in indexdef, fixes ./manage.py sqlfindindex

This commit is contained in:
j 2016-12-31 23:31:17 +01:00
parent 6ad112a3b8
commit ce2768e45f

View file

@ -47,7 +47,7 @@ class Command(BaseCommand):
drop = []
if column in indexes:
sql = "SELECT indexname, indexdef FROM pg_catalog.pg_indexes " + \
"WHERE indexname LIKE '%{table}%' AND indexname LIKE '%{column}%'".format(table=table, column=column)
"WHERE indexdef LIKE '%ON {table}%' AND indexdef LIKE '%{column}%'".format(table=table, column=column)
cursor.execute(sql)
for r in cursor:
if 'USING gin' not in r[1]: