Ask Your Question

Foreign key constraint is incorrectly formed [closed]

asked 2017-07-30 15:56:00 +0200

bobde gravatar image

I hope someone can help me with this.. ( I'm very new at base ) As a test, I created two tables, both with a clientID field, consecutive numbers in each field, both set as primary keys, both field types the same, both field names exactly the same. When I tried to relate the two tables I get Can't create table security.#sql-19c4_f4 (errno: 150 "Foreign key constraint is incorrectly formed") So I deleted the data in both tables and with two empty tables tried to relate the two fields and got the same error message



edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-10-11 14:50:58.278985

1 Answer

Sort by » oldest newest most voted

answered 2017-07-30 16:35:58 +0200

Ratslinger gravatar image

I believe the problem is with your understanding of relationships. The primary key of a table is to insure the uniqueness of a record. If you were to relate the primary key of one table to the primary key of another, it is just like extending the data in the first table. There is no real relationship.

What you want is a secondary field in the 'Master' record which points to a key in the 'Secondary' table (or vice versa depending upon what is being connected). This is where the linking comes in.

For a more complete description, please see the LO documentation - click here. Chapter 3 - Tables has a section on relationships.

If this answers your question please click on the ✔ (upper left area of answer).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-07-30 15:56:00 +0200

Seen: 724 times

Last updated: Jul 30 '17