Opened 4 years ago

Last modified 3 years ago

#17015 new Bug

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 aaugustin)

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 (8)

comment:1 Changed 4 years ago by aaugustin

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 4 years ago by ramiro

  • Summary changed from python manage.py syncdb to IntegrityError: ORA-01400: cannot insert NULL into (...."AUTH_PERMISSION"."ID") when running syncdb with Oracle

comment:3 Changed 3 years ago by anonymous

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 follow-up: Changed 3 years ago by 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?

comment:5 in reply to: ↑ 4 Changed 3 years ago by anonymous

  • 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 Changed 3 years ago by ikelly

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

comment:7 Changed 3 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

Accepting ticket based on Ian's comment.

comment:8 Changed 3 years ago by anonymous

issue exists also in Django 1.4

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