ORA-00001: unique constraint (OSADMIN.PK_OSSYS_USER_PERMISSION) violated

While trying to delete certain Role access for a user in Role Management, it gives "ORA-00001: unique constraint (OSADMIN.PK_OSSYS_USER_PERMISSION) violated" where in OSSYS_USER_PERMISSION is a Outsystems generated table. Same code working in one environment but failing in another post deployment.

It works in one environment and fails in another because the data is different.

Look into User_Permission and see the external keys. If one of them is UserRoleId and you are trying to delete the id that table needs (and it has delete rule=protect), it will give that precise error.


Nuno Reis wrote:

It works in one environment and fails in another because the data is different.

Look into User_Permission and see the external keys. If one of them is UserRoleId and you are trying to delete the id that table needs (and it has delete rule=protect), it will give that precise error.

Is it safe to remove the property delete rule = protect from User_Permission table as its a outsystems table? What could be the possible reason of it working in other environment but not in one environment while this delete rule = protect  may be applicable across all environments.



Sorry, I was sleeping when I wrote that! Didn't notice the "Outsystems table" part and now it wasn't making sense.

Forget what I said. "unique constraint violated" means you tried to write twice a value into a unique field.

Your delete is probably trying to write again the same data instead of deleting. Can you share a screenshot?

Thanks for the quick response.

The issue was due to data migration and got fixed by resetting the sequence of the table. :)