Constraint Fk Composite

Asked

Viewed 81 times

0

Hello,

I am creating a Foreign key Constraint composed like this:

alter table "Tabela1" add constraint constraint_fk foreign key ("Guid","Tabela2Id") references "Tabela2" ("Guid","Tabela2Id")

When I refresh you on the table, it appears like this:

constraint contraint_fk foreign key ("Tabela2Id","Guid") references "Tabela2" ("Tabela2Id","Guid")

This reversed the ids (Guid and Tabela2id)....

When I do the Insert for backend, I get a error:

inserir a descrição da imagem aqui

What I’m doing wrong?

  • Publishes the structure of the tables

  • I found the error, in table 2, the PK is ("Tabela2id","Guid"). Therefore, when creating the fk, automatically it reversed...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.