diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2011-10-16 20:06:59 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2011-10-16 20:06:59 +0000 |
| commit | 5f2be4ecbb5df3760f4c6e49170478719d3026d7 (patch) | |
| tree | da90282fd149735689a8c94a5a5c58a4acd2e738 | |
| parent | b7f2aba56608fc65843abf50d1c1cc32af533a72 (diff) | |
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
| -rw-r--r-- | django/db/models/sql/compiler.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/queries/tests.py | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 6bf7de2e21..cebd77fdb6 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -824,7 +824,7 @@ class SQLInsertCompiler(SQLCompiler): 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() diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py index bc8dcfdbb7..6a54125326 100644 --- a/tests/regressiontests/queries/tests.py +++ b/tests/regressiontests/queries/tests.py @@ -1868,3 +1868,12 @@ class UnionTests(unittest.TestCase): 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)") |
