#18514: Syncdb + Oracle + custom table name with quotes = Oracle 01741 error
----------------------------------------------+--------------------
     Reporter:  obmuc                         |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.2
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 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:
                 db_table = u'"ORACLE_SCHEMA"."DESIRED_TABLE_NAME"'
 }}}

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

 {{{
 $ ./manage.py syncdb
 Creating table "ORACLE_SCHEMA"."DESIRED_TABLE_NAME"
 Traceback (most recent call last):
   File "./manage.py", line 11, in <module>
     execute_manager(settings)
   File "[ intentionally obscured ]/lib/python2.6/site-
 packages/django/core/management/__init__.py", line 438, in execute_manager
     utility.execute()
   File "[ intentionally obscured ]/lib/python2.6/site-
 packages/django/core/management/__init__.py", line 379, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "[ intentionally obscured ]/lib/python2.6/site-
 packages/django/core/management/base.py", line 191, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "[ intentionally obscured ]/lib/python2.6/site-
 packages/django/core/management/base.py", line 220, in execute
     output = self.handle(*args, **options)
   File "[ intentionally obscured ]/lib/python2.6/site-
 packages/django/core/management/base.py", line 351, in handle
     return self.handle_noargs(**options)
   File "[ intentionally obscured ]/lib/python2.6/site-
 packages/django/core/management/commands/syncdb.py", line 99, in
 handle_noargs
     cursor.execute(statement)
   File "[ intentionally obscured ]/lib/python2.6/site-
 packages/django/db/backends/util.py", line 15, in execute
     return self.cursor.execute(sql, params)
   File "[ intentionally obscured ]/lib/python2.6/site-
 packages/django/db/backends/oracle/base.py", 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18514>
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to