Updating primary key db2 dating people in

We decided to add this restriction in 2.0.0 of two reasons.

First, the Objective-C/Swift product already had the restriction, and it is important to agree on the behaviour of primary keys.

Besides that, it is not recommended to change the value of primary keys in relational databases (see for example since values foreign keys also have to be updated.

One could argue that allowing changing the value of a primary key prior to 2.0.0 was a mistake at our side.

And we don't wish to avoid the behaviour in one set up, and disallow it in another.

If you have an standalone app, moving to Realm Mobile Platform must be as easy as possible.

(*You might argue that surrogate keys might do the job.

Second, we have to change the behaviour for Realm Mobile Platform.

Changing the value of a primary key on one device may lead to inconsistencies on another device.

That's the primary motivation behind many suggestions against updating PK.

Other battle-hardened (or battle-shredded) databases also suggest not to; Oracle advises against updating PK, IBM DB2 considers update on PK as deletion of an entry, and Maria DB wants PKs to be as stable as possible.

Leave a Reply