Dougoc / django-command-extensions

Automatically exported from code.google.com/p/django-command-extensions
MIT License
0 stars 0 forks source link

sqldiff does not quote table and field names in sql output #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using sql output field names are not quoted.

to reproduce:
1. create a model with a field named "order"
2. syncb
3. remove the field from the DB
4. sqldiff outputs invalid sql:

BEGIN
ALTER TABLE my_model
    DROP COLUMN order;
COMMIT;

"order" should be quoted, preferably "my_model" should be, too.

If I refer to django/db/backends/creation.py, they use
connection.ops.quote_name (as "qn"), like this:

style.SQL_FIELD(qn(f.column))

in sqldiff.py it happens around lines 260-265.

Original issue reported on code.google.com by bert.mat...@gmail.com on 27 Mar 2009 at 3:36

GoogleCodeExporter commented 9 years ago
sqldiff is now using connection.ops.quote_name to quote table names and fields.
thanks bert.mathieu

Original comment by v.oostv...@gmail.com on 30 Mar 2009 at 9:48