jamesaoverton / cmi-pb-terminology

CMI-PB Controlled Terminology
0 stars 0 forks source link

All rows with invalid unique or primary key values should be inserted to conflict tables #46

Closed lmcmicu closed 2 years ago

lmcmicu commented 2 years ago

Currently, if value of a primary key field conflicts with an existing value for that field in the table, then we add that row to the conflict rather than the main table. This is the right behaviour.

However if there is some other problem with a primary or unique key field (e.g., it has leading space), then the value of the field is inserted to the table as NULL. SQLite happily accepts this, but we will likely run into problems with Postgres.

We need to insert all rows with invalid unique or primary key fields to their corresponding conflict table, not just rows with non-unique values.

lmcmicu commented 2 years ago

Fixed by #42