If you pass on_conflict: :nothing, it will literally do nothing and return the category as is. One trick is to try to change a fixed value, that you know it won’t change. For example, if categories have unique name and that’s the column you are checking, you can do this:
Oh, when you give PostgreSQL a list of updates to perform, it also expects the :conflict_target option, which is the column (or a list of columns) we are expecting the conflict to happen:
@maxs I have no idea what it actually does, I would imagine databases would optimize it but no guarantees. When benchmarking I could see no time difference.