ckan
ckan copied to clipboard
_dict_save create or update instead of upsert
CKAN version
all
Describe the bug
In model_save.py the various _dict_save functions check for the existence of a row with the same id before deciding whether to create or update the row. This is something we should already know at the action level, not need to detect in model_save.py, and detecting this way means postgres can't help us prevent mistakes.
Steps to reproduce
Expected behavior
Create actions should only ever create not update existing rows. Update actions should only update not create rows.
Additional details
https://github.com/ckan/ckan/pull/8069#discussion_r1604925141