Postgres has Added UPSERT
One of the things I've always wanted in Postgres is the UPSERT - an INSERT that would update certain fields if the row (defined by the primary key) already existed. In the past, I've had to implement this as a custom function (stored procedure) in pl/sql, by checking for the existence of the row and then doing an UPDATE, or failing that, do an INSERT. It's workable, and it's not horrible, but it's also something that's in several other databases, and I wanted it in my database. 🙂
This morning I read a tweet that said:
and read the commit log message that described it. I love it! This is exactly what I've been hoping for.
The only question now is - When is it released?