Error, Can't update records

I have 2 tables, one is “Data_Clients” where I have a field for “Country” and a second table named “List_Countires” just for the list of countries where the name field of the country is the primary key.
Both tables are linked with a relationship where “List_Countires” has a one to many rleation to “Data_Clients”

Then I have a form where I have a list box to choose the country for each record.
I noticed I made a typo and wanted to fix it manually in the “List_Countires” table but then I get this error

error

database - hsqldb
lo version - 25.2.1.2
os - Fedora 41

Therefore you are not allowed to change this, if this key is used.
.
You can:

  • Export all rows wich refer the typo to an external place, then delete them from your database
  • Correct you typo in the primary key
  • Correct it in the externally saved rows and re-import

Consider using separate id-fields. You never now, when somebody renames items “south of louisiana” or elsewhere.

I see, but how would I refrence the country name field then?
If I use an ID field for the table “List_Countires” then I can’t link both country fields in “Data_Customers” and “List_Countries”

I’m new to Base and databases in general so I might be understanding something incorrectly.
Maybe im expecting behaviour which is not how databases work?

If I have a table for my list, how do I reference the list items in other tables and have them also update in case I change them later?

I think I just solved it myself…

I used the List table with just one field as the primery key and in the relationships window I figured out you can right click the connection and edit the relationship, there I set the “update option” to update cascade and “delete option” to set to null. And now I can update the list table and it will update all the records everywhere else they’re refrenced.

Not sure If that’s the correct way to do it but it seem to work.

1 Like