Ticket #572 (closed defect: fixed)
Incompatibility with tables manually specifying postgres schemas
|Reported by:||agrossman@…||Owned by:||andrew|
A method for specifying postgres schemas to be used within Django is specified here : http://firstname.lastname@example.org/msg54866.html .
From this, the syntax for specifying a schema-located table when declaring a Django model is:
class Meta: db_table = '"myschema"."mytable"'
South is compatible with the creation of tables; however, when trying to create a table that references another table using this method, South migrate encounters an error.
The SQL it generates is in the following format:
CREATE INDEX ""myschema"."mytable"_my_foreign_column_id" ON "myschema"."mytable" ("my_foreign_column_id");
The quoting mechanism is not currently fully compatible with this syntax; while it could be considered non-standard Django, it would seem that correcting this problem would not be overly difficult.
The fix in south/db/generic.py is as follows:
index_name = ('%s_%s%s%s' % (table_name, column_names, index_unique_name, suffix))
index_name = ('%s_%s%s%s' % (table_name, column_names, index_unique_name, suffix)).replace('"', '').replace('.', '_')
I have attached a patch that fixes the problem. It is applied to south/db/generic.py .
- Status changed from assigned to closed
- Resolution set to fixed
- Milestone changed from 1.0 to 0.7.3
- Status changed from closed to reopened
- Resolution fixed deleted