Cdb_set_elem does not return error if performed on key field of a list entry

When we try to change key value of a list entry using cdb_set_elem, as key should not be changed so it does not.
but function return success, why it does not return failure?

Can you show us some pseudo code and YANG to save us from guessing?