-
Notifications
You must be signed in to change notification settings - Fork 1
Description
The PostgreSQL implementation of the keyvalue() method relies on the memory distance between an object being identifies and its container (the root value, a variable, or an object generated by keyvalue() itself). This produces reliable, repeatable IDs because the layout of JSONB objects is deterministic.
The go implementation, in keyvalue.go, follows suit, calculating the memory distance between a map and its containing map. This distance, however, is not deterministic, so different executions with the same JSON can produce different IDs. This isn't an issue for execution of a single map, but if consistency is desired across executions for different JSON objects — if, say, the map is re-create by parsing the same JSON value, the IDs can change.
Look into whether there might be some other method to create more consistent IDs across executions with different instances of equivalent maps and slices. There may not be one, and it may not become an issue. But if it does, some other (more expensive) pattern might need to be adopted.