I have a database with 2 tables. A call sec_users
with the following fields:
-
pk_user
login
pswd
Another table called solicitud
with the following fields:
-
pk_solicitud
fk_usuario
fecha
Each user can create a request. The field fk_usuario
of table solicitud
is foreign key of field login
of table sec_users
Well I created a request for example with user1:
pk_solicitud fk_usuario fecha
=================== ============= ==============
1 usuario1 2018/04/02
So far so good, my problem comes when I want to modify the user login that instead of user1, I want to change it to user3 and I get this error:
Cannot delete or update a parent row: a foreign key constraint fails ('bd_vacaciones'.'solicitud', CONSTRAINT 'Usuario' FOREIGN KEY ('fk_usuario') REFERENCES 'sec_users' ('login') ON DELETE NO ACTION ON UPDATE NO ACTION)
My sentence is this:
update sec_users set login='usuario3' where login = 'usuario1'
Any solution?