Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #17056 -- Tweaked insert SQL clause generation so a corner case…

… doesn't fail with Oracle.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5f2be4ecbb5df3760f4c6e49170478719d3026d7 1 parent b7f2aba
Ramiro Morales authored October 16, 2011
2  django/db/models/sql/compiler.py
@@ -824,7 +824,7 @@ def as_sql(self):
824 824
                 for val in values
825 825
             ]
826 826
         if self.return_id and self.connection.features.can_return_id_from_insert:
827  
-            params = values[0]
  827
+            params = params[0]
828 828
             col = "%s.%s" % (qn(opts.db_table), qn(opts.pk.column))
829 829
             result.append("VALUES (%s)" % ", ".join(placeholders[0]))
830 830
             r_fmt, r_params = self.connection.ops.return_insert_id()
9  tests/regressiontests/queries/tests.py
@@ -1868,3 +1868,12 @@ def test_BA_BCA__BAB_BAC_BCA(self):
1868 1868
         Q1 = Q(objecta__name='one', objectc__objecta__name='two')
1869 1869
         Q2 = Q(objecta__objectc__name='ein', objectc__objecta__name='three', objecta__objectb__name='trois')
1870 1870
         self.check_union(ObjectB, Q1, Q2)
  1871
+
  1872
+
  1873
+class DefaultValuesInsertTest(TestCase):
  1874
+    def test_no_extra_params(self):
  1875
+        # Ticket #17056 -- affects Oracle
  1876
+        try:
  1877
+            DumbCategory.objects.create()
  1878
+        except TypeError:
  1879
+            self.fail("Creation of an instance of a model with only the PK field shouldn't error out after bulk insert refactoring (#17056)")

0 notes on commit 5f2be4e

Please sign in to comment.
Something went wrong with that request. Please try again.