Two years back, I wrote a blog post titled “PostgreSQL – Mastering UPSERT“, in which I explored the nuances of the INSERT ON CONFLICT command that allows conditional inserts or updates of rows.
Continuing its database technology innovation, PostgreSQL 15 has introduced an exciting new feature – the MERGE command. This command offers a more versatile approach to INSERT, UPDATE, or even DELETE rows in a table based on specific conditions. In this post, we’ll delve into the intricacies of this new MERGE command.