Author: ramiro
Date: 2011-10-16 13:06:59 -0700 (Sun, 16 Oct 2011)
New Revision: 16997
Modified:
django/trunk/django/db/models/sql/compiler.py
django/trunk/tests/regressiontests/queries/tests.py
Log:
Fixed #17056 -- Tweaked insert SQL clause generation so a corner case doesn't
fail with Oracle.
Modified: django/trunk/django/db/models/sql/compiler.py
===================================================================
--- django/trunk/django/db/models/sql/compiler.py 2011-10-16 14:30:43 UTC
(rev 16996)
+++ django/trunk/django/db/models/sql/compiler.py 2011-10-16 20:06:59 UTC
(rev 16997)
@@ -824,7 +824,7 @@
for val in values
]
if self.return_id and
self.connection.features.can_return_id_from_insert:
- params = values[0]
+ params = params[0]
col = "%s.%s" % (qn(opts.db_table), qn(opts.pk.column))
result.append("VALUES (%s)" % ", ".join(placeholders[0]))
r_fmt, r_params = self.connection.ops.return_insert_id()
Modified: django/trunk/tests/regressiontests/queries/tests.py
===================================================================
--- django/trunk/tests/regressiontests/queries/tests.py 2011-10-16 14:30:43 UTC
(rev 16996)
+++ django/trunk/tests/regressiontests/queries/tests.py 2011-10-16 20:06:59 UTC
(rev 16997)
@@ -1868,3 +1868,12 @@
Q1 = Q(objecta__name='one', objectc__objecta__name='two')
Q2 = Q(objecta__objectc__name='ein', objectc__objecta__name='three',
objecta__objectb__name='trois')
self.check_union(ObjectB, Q1, Q2)
+
+
+class DefaultValuesInsertTest(TestCase):
+ def test_no_extra_params(self):
+ # Ticket #17056 -- affects Oracle
+ try:
+ DumbCategory.objects.create()
+ except TypeError:
+ self.fail("Creation of an instance of a model with only the PK
field shouldn't error out after bulk insert refactoring (#17056)")
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.