Skip to content

Commit c6a3546

Browse files
kgrinbergtimgraham
authored andcommitted
Fixed #28451 -- Restored pre-Django 1.11 Oracle sequence/trigger naming.
Regression in 69b7d4b.
1 parent 4dfd6b8 commit c6a3546

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ answer newbie questions, and generally made Django that much better:
441441
Keith Bussell <kbussell@gmail.com>
442442
Kenneth Love <kennethlove@gmail.com>
443443
Kent Hauser <kent@khauser.net>
444+
Kevin Grinberg <kevin@kevingrinberg.com>
444445
Kevin Kubasik <kevin@kubasik.net>
445446
Kevin McConnell <kevin.mcconnell@gmail.com>
446447
Kieran Holland <http://www.kieranholland.com>

django/db/backends/oracle/operations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,7 @@ def _get_no_autofield_sequence_name(self, table):
518518
AutoFields that aren't Oracle identity columns.
519519
"""
520520
name_length = self.max_name_length() - 3
521-
sequence_name = '%s_SQ' % strip_quotes(table)
522-
return truncate_name(sequence_name, name_length).upper()
521+
return '%s_SQ' % truncate_name(strip_quotes(table), name_length).upper()
523522

524523
def _get_sequence_name(self, cursor, table, pk_name):
525524
cursor.execute("""

docs/releases/1.11.5.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ Bugfixes
1515
* Fixed test database creation with ``cx_Oracle`` 6 (:ticket:`28498`).
1616

1717
* Fixed select widget rendering when option values are tuples (:ticket:`28502`).
18+
19+
* Django 1.11 inadvertently changed the sequence and trigger naming scheme on
20+
Oracle. This causes errors on INSERTs for some tables if
21+
``'use_returning_into': False`` is in the ``OPTIONS`` part of ``DATABASES``.
22+
The pre-11.1 naming scheme is now restored. Unfortunately, it necessarily
23+
requires an update to Oracle tables created with Django 1.11.[1-4]. Use the
24+
upgrade script in :ticket:`28451` comment 8 to update sequence and trigger
25+
names to use the pre-1.11 naming scheme
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import unittest
2+
3+
from django.db import connection
4+
5+
6+
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
7+
class OperationsTests(unittest.TestCase):
8+
9+
def test_sequence_name_truncation(self):
10+
seq_name = connection.ops._get_no_autofield_sequence_name('schema_authorwithevenlongee869')
11+
self.assertEqual(seq_name, 'SCHEMA_AUTHORWITHEVENLOB0B8_SQ')

0 commit comments

Comments
 (0)