Use PostgreSQL 15 MERGE operator
PostgreSQL 15 introduced the MERGE
operator: https://www.postgresql.org/docs/15/sql-merge.html
This allows to INSERT
/UPDATE
/DELETE
in one single statement. Currently we have this code:
i.e. we insert/update/delete rows by hand in Haskell (node stories).
The task is to rewrite this into PostgreSQL 15 MERGE
.
This might help in tricky issues such as #303 (closed) (it's better to do one PostgreSQL transaction than split things in the backend).