#17056: Creation of instances of a PK-only model fails under Oracle after introduction of bulk insert feature -------------------------------------+------------------------------------- Reporter: ramiro | Owner: nobody Type: Bug | Status: new Component: Database | Version: SVN layer (models, ORM) | Keywords: Severity: Normal | Has patch: 0 Triage Stage: | Needs tests: 0 Unreviewed | Easy pickings: 0 Needs documentation: 0 | Patch needs improvement: 0 | UI/UX: 0 | -------------------------------------+------------------------------------- After r16739, trying to create an instance of this model:
{{{ from django.db import models class Book(models.Model): pass }}} with: {{{ >>> from django.test import TestCase >>> from models import Book >>> Book.objects.create() }}} generates an error like this when run against Oracle: {{{ Traceback (most recent call last): File "dtest/dtest01/store/tests.py", line 9, in test_insert Book.objects.create() File "django/upstream/django/db/models/manager.py", line 137, in create return self.get_query_set().create(**kwargs) File "django/upstream/django/db/models/query.py", line 372, in create obj.save(force_insert=True, using=self.db) File "django/upstream/django/db/models/base.py", line 464, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "django/upstream/django/db/models/base.py", line 551, in save_base result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw) File "django/upstream/django/db/models/manager.py", line 203, in _insert return insert_query(self.model, objs, fields, **kwargs) File "django/upstream/django/db/models/query.py", line 1556, in insert_query return query.get_compiler(using=using).execute_sql(return_id) File "django/upstream/django/db/models/sql/compiler.py", line 848, in execute_sql cursor.execute(sql, params) File "django/upstream/django/db/backends/oracle/base.py", line 651, in execute query = convert_unicode(query % tuple(args), self.charset) TypeError: not all arguments converted during string formatting }}} The compiler is generating the `"DEFAULT"` SQL keyword twice, once as part of the SQL query literal and once in the arguments tuple: {{{ [ ( 'INSERT INTO "STORE_BOOK" ("ID") VALUES (DEFAULT) RETURNING "STORE_BOOK"."ID" INTO %s', ('DEFAULT', <django.db.backends.oracle.base.InsertIdVar object at 0x912c0ac>) ) ] }}} Currently, Django own test suite shows 80 errors of this type. -- Ticket URL: <https://code.djangoproject.com/ticket/17056> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.