diff options
| author | Simon Charette <charette.s@gmail.com> | 2016-06-21 00:01:03 -0400 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2016-06-21 16:38:00 -0400 |
| commit | 23ac35af19face4ad0b466f5aaffafd5db98db0e (patch) | |
| tree | 31c4bcb9bf82fd85196ac9a78b1dd84a1995474a /django | |
| parent | 1b0b6f0342e5ac9e3e789ca522ad64a532602c3f (diff) | |
[1.10.x] Fixed #26781 -- Made table name case change a noop on SQLite.
SQLite disgresses from the SQL standard by ignoring case of quoted identifiers.
Thanks to laozzzi for the report and Tim for the review.
Backport of c2e62fd1aed093c4d9ff84e3d86e6a85c8aa1917 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/base/features.py | 4 | ||||
| -rw-r--r-- | django/db/backends/base/schema.py | 4 | ||||
| -rw-r--r-- | django/db/backends/oracle/features.py | 3 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/features.py | 1 |
4 files changed, 11 insertions, 1 deletions
diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index 91065ecc99..484b272294 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -221,6 +221,10 @@ class BaseDatabaseFeatures(object): # Defaults to False to allow third-party backends to opt-in. can_clone_databases = False + # Does the backend consider quoted identifiers with different casing to + # be equal? + ignores_quoted_identifier_case = False + def __init__(self, connection): self.connection = connection diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index 2fd0d2738c..156f119c0d 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -363,7 +363,9 @@ class BaseDatabaseSchemaEditor(object): """ Renames the table a model points to. """ - if old_db_table == new_db_table: + if (old_db_table == new_db_table or + (self.connection.features.ignores_quoted_identifier_case and + old_db_table.lower() == new_db_table.lower())): return self.execute(self.sql_rename_table % { "old_table": self.quote_name(old_db_table), diff --git a/django/db/backends/oracle/features.py b/django/db/backends/oracle/features.py index ee300f3530..84e18cf9ba 100644 --- a/django/db/backends/oracle/features.py +++ b/django/db/backends/oracle/features.py @@ -40,6 +40,9 @@ class DatabaseFeatures(BaseDatabaseFeatures): # select for update with limit can be achieved on Oracle, but not with the current backend. supports_select_for_update_with_limit = False supports_temporal_subtraction = True + # Oracle doesn't ignore quoted identifiers case but the current backend + # does by uppercasing all identifiers. + ignores_quoted_identifier_case = True def introspected_boolean_field_type(self, field=None, created_separately=False): """ diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index acf20d569f..e834ec61a3 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -39,6 +39,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_sequence_reset = False can_clone_databases = True supports_temporal_subtraction = True + ignores_quoted_identifier_case = True @cached_property def uses_savepoints(self): |
