ceduard0
ceduard0

Reputation: 17

django.db.utils.DatabaseError: ORA-30673: column to be modified is not an identity column

thanks everybody, I have a django project, this is my enviroment:

Database: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

Python: Python 3.5.1rc1 cx-Oracle==6.3 Django==2.0.4

I am trying this:

 python manage.py test

I am getting this error:

django.db.utils.DatabaseError: ORA-30673: column to be modified is not an identity column

Thanks.

Upvotes: 1

Views: 923

Answers (1)

Littlefoot
Littlefoot

Reputation: 142798

It appears that you are trying to set a column to be the identity column, using the ALTER TABLE command. Oracle, however, tells you that you can't do that.

An example:

Create a table:

create table test (id number);

This command raises the ORA-30673:

alter table test modify id number generated by default on null as identity;

You should create a new identity column:

alter table test add id_new number generated by default on null as identity;

Then copy data into a new column, if necessary:

update test set id_new = id;

Drop the old ID column:

alter table test drop column id;

Rename the new column to the old name:

alter table test rename column id_new to id;

Expect problems if the old ID column was a primary key, used in enforcing foreign key constraint(s).

Upvotes: 4

Related Questions