Reply to post: Re: Is it bad design

Say oops, UPSERT your head: PostgreSQL version 9.5 has landed

Anonymous Coward
Anonymous Coward

Re: Is it bad design

> "I am a postgres fan, but when I make a table without a database driven primary key which kind of requires an upset, I always think it's bad design."

You might have got the wrong end of the stick - MERGE (SQL Server/ANSI standard version of UPSERT) is great for doing data imports when you'll have some inserts, some updates, and some deletes. Yes, you could write it as 3 statements (insert, update, delete), but sometimes just having it in a single statement can increase code clarity quite a bit by making intentions exceptionally obvious.

https://www.simple-talk.com/sql/learn-sql-server/the-merge-statement-in-sql-server-2008/

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon