Django

Code

Ticket #4140 (assigned)

Opened 1 year ago

Last modified 7 months ago

[boulder-oracle]: manage.py syncdb fails with ORA-06552 when a fieldname is a keyword

Reported by: frank.hoffsummer@gmail.com Assigned to: ikelly (accepted)
Milestone: Component: django-admin.py
Version: SVN Keywords: oracle Oracle
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

calling "manage.py syncdb log" with my log model on an empty Oracle database yields the following exception

Traceback (most recent call last):
  File "./manage.py", line 11, in ?
    execute_manager(settings)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django/core/management.py", line 1730, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django/core/management.py", line 1627, in execute_from_command_line
    action_mapping[action](int(options.verbosity), options.interactive)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django/core/management.py", line 573, in syncdb
    cursor.execute(statement)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django/db/backends/util.py", line 13, in execute
    return self.cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django/db/backends/oracle/base.py", line 104, in execute
    return Database.Cursor.execute(self, query, params)
cx_Oracle.DatabaseError: ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed

the model myapp/log/models.py is simple and causes no problem in MySQL, I attached it to this ticket. a subsequent, second run of manage py syncdb goes without error.

Attachments

models.py (2.3 kB) - added by frank.hoffsummer@gmail.com on 04/24/07 03:52:24.
model that causes the syncdb error

Change History

04/24/07 03:52:24 changed by frank.hoffsummer@gmail.com

  • attachment models.py added.

model that causes the syncdb error

04/24/07 10:03:55 changed by bouldersprinters

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

In your LogMessage? model, the first column is named "timestamp". This is an Oracle reserved keyword (we've often seen columns named "date" cause the same problem). Renaming it and the references to it in that module fixes the problem.

Unfortunately, Oracle will gladly create the table for you even with an illegal column name that you won't be able to SELECT on. Then when trying to compile the trigger referencing that table, it will bomb with "ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed," an utterly unhelpful error message.

This is brain-damaged Oracle behavior we can't fix, but we could perhaps put in a check somewhere for SQL reserved words as column names so that the problem is flagged earlier, with an informative message.

04/29/07 22:35:01 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Unreviewed to Design decision needed.

04/29/07 22:35:17 changed by Simon G. <dev@simon.net.nz>

  • summary changed from [boulder-oracle]: manage.py syncdb fails with ORA-06552 to [boulder-oracle]: manage.py syncdb fails with ORA-06552 when a fieldname is a keyword.

09/21/07 00:48:24 changed by mboersma

  • keywords changed from oracle to oracle Oracle.
  • version changed from other branch to SVN.

12/01/07 16:03:18 changed by ikelly

  • owner changed from nobody to ikelly.
  • status changed from new to assigned.

12/01/07 16:11:37 changed by ikelly

  • stage changed from Design decision needed to Accepted.

Add/Change #4140 ([boulder-oracle]: manage.py syncdb fails with ORA-06552 when a fieldname is a keyword)




Change Properties
Action