-
Notifications
You must be signed in to change notification settings - Fork 288
Document that update intrinsics of C DB API cannot change primary key #819
Comments
is this ticket still valid? |
Yes according to @arhag. The description or remarks section of the db_update_i64() intrinsic just needs to specify that the primary key won't be updated (which is obvious but should still be said). |
the dev portal is currently picking up the annotation from the eos repo file and it is placing it here therefore is it ok to move this issue to eos repo? |
The host function implementations aren't the same as the C API in CDT with respect to the interface. If that is the path we are looking to take. I.e. moving the documentation from CDT to EOS, then we need some transforms for the types. If not it will be incredibly non-obvious to contract devs and toolchain devs as to what a |
The current (as of v1.0.5) update intrinsics of the C DB API do not allow changing the primary key of a table row. The serialized data that is stored in the table row of a primary table may include a primary key and that primary key value could be changed by the contract calling the
db_update_i64
intrinsic. But that does not change the actual primary key recognized by the native side.This behavior should be well documented for contract developers that use the C DB API. Those using the C++
multi_index
shouldn't have to worry about this (although it should still be documented) because themodify
method will check that the primary key was not changed by theupdater
lambda and cause an assertion failure otherwise.The text was updated successfully, but these errors were encountered: