Opened 4 years ago

Last modified 4 years ago

#18514 new Bug

Syncdb + Oracle + custom table name with quotes = Oracle 01741 error

Reported by: obmuc Owned by: nobody
Component: Database layer (models, ORM) Version: 1.2
Severity: Normal Keywords: oracle
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Using a custom table name with Oracle, and entering the full-qualified oracle schema + table name with quotes, is resulting in an Oracle 17141 error when running syncdb: "illegal zero-length identifier". The all-knowing Google indicates this is due to an empty string ("") being passed to Oracle.

Example Model:

class MyModel(models.Model):
	a_field = models.CharField(max_length=1000, blank=True, null=True)
	class Meta:

Executing the syncdb management command to create that table results in the following:

$ ./ syncdb
Traceback (most recent call last):
  File "./", line 11, in <module>
  File "[ intentionally obscured ]/lib/python2.6/site-packages/django/core/management/", line 438, in execute_manager
  File "[ intentionally obscured ]/lib/python2.6/site-packages/django/core/management/", line 379, in execute
  File "[ intentionally obscured ]/lib/python2.6/site-packages/django/core/management/", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "[ intentionally obscured ]/lib/python2.6/site-packages/django/core/management/", line 220, in execute
    output = self.handle(*args, **options)
  File "[ intentionally obscured ]/lib/python2.6/site-packages/django/core/management/", line 351, in handle
    return self.handle_noargs(**options)
  File "[ intentionally obscured ]/lib/python2.6/site-packages/django/core/management/commands/", line 99, in handle_noargs
  File "[ intentionally obscured ]/lib/python2.6/site-packages/django/db/backends/", line 15, in execute
    return self.cursor.execute(sql, params)
  File "[ intentionally obscured ]/lib/python2.6/site-packages/django/db/backends/oracle/", line 595, in execute
    return self.cursor.execute(query, self._param_generator(params))
django.db.utils.DatabaseError: ORA-01741: illegal zero-length identifier
ORA-06512: at line 8

The table is otherwise usable with the Django ORM once created - just errors on attempt to create via syncdb.

Change History (1)

comment:1 Changed 4 years ago by Aymeric Augustin

Keywords: oracle added
Triage Stage: UnreviewedAccepted
Note: See TracTickets for help on using tickets.
Back to Top