﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22910	sqldropindexes yields wrong indexes names when using postgresql_psycopg2	anonymous	nobody	"If you are using a postgres database (with postgresql_psycopg2), and run:

{{{
./manage.py sqldropindexes example_app
}}}

The DROP INDEX commands printed have the index names wrong, with random strings at the end of them.

Example:

With these simple models:

{{{
class City(models.Model):
    name = models.CharField(max_length=50)

class Human(models.Model):
    name = models.CharField(max_length=50)
    city = models.ForeignKey(City)
}}}

If you run the sqlindexes command (which works ok), it outputs this:

{{{
./manage.py sqlindexes example_app
BEGIN;
CREATE INDEX ""app_human_city_id"" ON ""app_human"" (""city_id"");

COMMIT;
}}}

But if you run the sqldropindexes command, it outputs this, which has the indexes names broken:

{{{
/manage.py sqldropindexes example_app
BEGIN;
DROP INDEX ""app_human_b376980e"" ;

COMMIT;
}}}

"	Bug	closed	Database layer (models, ORM)	1.6	Normal	duplicate	sqldropindexes,postgresql		Unreviewed	0	0	0	0	0	0
