Opened 12 years ago

Closed 8 years ago

#17015 closed Bug (needsinfo)

IntegrityError: ORA-01400: cannot insert NULL into (...."AUTH_PERMISSION"."ID") when running syncdb with Oracle

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

Description (last modified by Aymeric Augustin)

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/oracle/base.py", line 631, in execute
    return self.cursor.execute(query, self._param_generator(params))
django.db.utils.IntegrityError: ORA-01400: cannot insert NULL into ("SMS2WLN"."AUTH_PERMISSION"."ID")

I saw its fixed but I am getting it again in 1.3.1 and my cx_Oracle is 5.1

I am new to python and django...please help.

Change History (9)

comment:1 by Aymeric Augustin, 12 years ago

Description: modified (diff)

This appears to be the same problem as #16454, which I never managed to reproduce.

comment:2 by Ramiro Morales, 12 years ago

Summary: python manage.py syncdbIntegrityError: ORA-01400: cannot insert NULL into (...."AUTH_PERMISSION"."ID") when running syncdb with Oracle

comment:3 by anonymous, 12 years ago

I can confirm this issue still exists.

Scientific Linux 6.1 x86_64
Python 2.6.6
cx_Oracle-5.1.1
Django-1.3.1
Oracle 11.2.0 XE
  1. After clean install, changed settings.py to oracle engine and tried to run a syncdb

    python manage.py syncdb

File "/usr/lib/python2.6/site-packages/django/db/backends/oracle/base.py", line 631, in execute
    return self.cursor.execute(query, self._param_generator(params))
django.db.utils.IntegrityError: ORA-01400: cannot insert NULL into ("TEST1"."AUTH_PERMISSION"."ID")

comment:4 by Erin Kelly, 12 years ago

Sounds to me like the sequence trigger is missing for some reason. Can you verify whether the TEST1.AUTH_PERMISSION table has any triggers on it?

in reply to:  4 comment:5 by anonymous, 12 years ago

Keywords: oracle trigger added

Replying to ikelly:

Sounds to me like the sequence trigger is missing for some reason. Can you verify whether the TEST1.AUTH_PERMISSION table has any triggers on it?

You are right, I checked the "AUTH_PERMISSION" table and it does not have a trigger.

On other instances that work with oracle, the trigger "AUTH_PERMISSION_TR" exists.

I did the following to resolve this issue.

drop table AUTH_PERMISSION; grant trigger to TEST1; python manage.py syncdb;

I didn't get the error anymore and verified the trigger was created.

It seems that on the initial syncdb it was able to create all objects except triggers because it didn't have that permission.
Shouldn't the syncdb catch the permissions error for triggers like it does on sequence?

comment:6 by Erin Kelly, 12 years ago

It should, yes. I'll have to do some digging to try to figure out why it evidently doesn't.

comment:7 by Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedAccepted

Accepting ticket based on Ian's comment.

comment:8 by anonymous, 12 years ago

issue exists also in Django 1.4

comment:9 by Tim Graham, 8 years ago

Resolution: needsinfo
Status: newclosed

Closing as "needsinfo" as we lack steps to reproduce the issue.

Note: See TracTickets for help on using tickets.
Back to Top