Opened 8 years ago

Closed 8 years ago

#27321 closed Bug (fixed)

ignores_quoted_identifier_case broken on MySQL on OS X/Windows

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords: mysql, mariadb
Cc: me@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adam Johnson)

#26781 added the ignores_quoted_identifier_case database feature, which defaults to False, so it's False for the MySQL backend. Unfortunately this can't be determined without reference to the filesystem that the tables are stored on - MySQL and MariaDB rely on the underlying filesystem to provide case sensitivity, as well as a setting, as per https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html and https://mariadb.com/kb/en/mariadb/identifier-case-sensitivity/ .

Thus the added test, test_alter_db_table_case, fails on OS X where the default filesystem is case insensitive, with:

django.db.utils.InternalError: (1050, "Table 'SCHEMA_AUTHOR' already exists")

I can't find any good information on whether PostgreSQL depends on filesystem case sensitive or not. All the results I found in five minutes of Googling seem to relate to whether it's syntactically case sensitive, and suggest it lowercases all table names in queries unless they are double-quoted, which would make renaming a table to uppercase a no-op anyway?

ignores_quoted_identifier_case should be True for MySQL when its data directory is mounted on a case insensitive filesystem. The only way to reliably check this that I can think of would be to try create two tables with names that differ only in case and seeing if the second one failed, which is kind of nasty.

Change History (6)

comment:1 by Adam Johnson, 8 years ago

Description: modified (diff)

comment:2 by Claude Paroz, 8 years ago

Triage Stage: UnreviewedAccepted

... or we could be a little bit less reliable and test the tmp file system with some trick like that.

comment:3 by Adam Johnson, 8 years ago

That's making the assumption that MySQL is running on the same computer as Django, which might not be the case...

comment:4 by Adam Johnson, 8 years ago

Cc: me@… added
Has patch: set
Owner: changed from nobody to Adam Johnson
Status: newassigned
Last edited 8 years ago by Tim Graham (previous) (diff)

comment:5 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In 95238a7d:

Fixed #27321 -- Added detection for table case name sensitivity on MySQL.

Note: See TracTickets for help on using tickets.
Back to Top