summaryrefslogtreecommitdiff
path: root/django/db/backends/utils.py
diff options
context:
space:
mode:
authorAndrew Nester <andrew.nester.dev@gmail.com>2016-12-31 01:11:12 +0300
committerTim Graham <timograham@gmail.com>2016-12-30 17:11:12 -0500
commit69b7d4b116e3b70b250c77829e11038d5d55c2a8 (patch)
tree71b093eb6a2391de013e8cb82b7ce06d6298949a /django/db/backends/utils.py
parent398a859642636a2de0ab920befa320cd9954b49a (diff)
Fixed #27458 -- Fixed invalid sequence/index names when using "USER"."TABLE" db_table on Oracle.
Diffstat (limited to 'django/db/backends/utils.py')
-rw-r--r--django/db/backends/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/django/db/backends/utils.py b/django/db/backends/utils.py
index c01bcc2598..73f1dbb690 100644
--- a/django/db/backends/utils.py
+++ b/django/db/backends/utils.py
@@ -209,3 +209,13 @@ def format_number(value, max_digits, decimal_places):
if decimal_places is not None:
return "%.*f" % (decimal_places, value)
return "{:f}".format(value)
+
+
+def strip_quotes(table_name):
+ """
+ Strip quotes off of quoted table names to make them safe for use in index
+ names, sequence names, etc. For example '"USER"."TABLE"' (an Oracle naming
+ scheme) becomes 'USER"."TABLE'.
+ """
+ has_quotes = table_name.startswith('"') and table_name.endswith('"')
+ return table_name[1:-1] if has_quotes else table_name