oracle syncdb crashes while setting column to NULL when it already is NULL

41 views
Skip to first unread message

Joris Benschop

unread,
Feb 5, 2015, 9:40:32 AM2/5/15
to django...@googlegroups.com
hi

I'm not sure if this is a dev question or it should be posted here. Probably I did something dumb, so I hope you can help me doscover what that is:

I'm trying to syncdb to an empty Oracle DB. Many tables, triggers and sequences are made but then this:
----------------------------------
...
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0002_remove_content_type_name...DEBUG ALTER TABLE "DJANGO_CONTENT_TYPE" MODIFY "NAME" NULL; (params [])
DEBUG (0.055) QUERY = u'ALTER TABLE "DJANGO_CONTENT_TYPE" MODIFY "NAME" NULL' - PARAMS = (); args=[]
Traceback (most recent call last):
...
...
django.db.utils.DatabaseError: ORA-01451: column to be modified to NULL cannot be modified to NULL
----------------------------------

Indeed if I run this in oracle directly:
ALTER TABLE "DJANGO_CONTENT_TYPE" MODIFY "NAME" NULL;
I get the same error: you cannot change a NULL column into NULL

I don't understand why django wants to alter a column name of a table it just made a few seconds before, but still.
What seems to happen is that it changes a column to NULL, but because it already is NULL, the statement fails.
Workaround is to manually set:
ALTER TABLE "DJANGO_CONTENT_TYPE" MODIFY ("NAME" NOT NULL);
Then run syncdb again and the error is gone.

I can see this is sillyness of oracle, but theres not much I can do about that. Is this a bug that I should report with the devs?

thanks
Joris

Reply all
Reply to author
Forward
0 new messages