Closed fguimond closed 1 year ago
While no feature can ever be added without also adding complexity, some features need more complexity than others. This feature can be added with fairly minimal complexity.
Knowing if a resource can be created or not is a simple matter of looking at the xmax system column. When xmax = 0, the row was inserted. Otherwise, it will not equal 0.
Knowing if a resource should be updated or not is a matter of computing and storing the entity tag for the resource. We can easily have postgres do this for us with the pgcrypto extension, which is available by default on RDS and most other deployments. The etag can be stored in a new etag column, which will hold the checksum of the resource. If the database detects that the user is attempting to store a resource with the same etag, it can report that the resource wasn't modified by returning the existing etag, and the updated etag, and letting the user compare them.
See if features from the Postgres API such as rows affected can be used to implement #4631 without adding complexity. The original issue's milestone should be updated based on the output of this spike.