6

So, here we are using postgres in production with the fancy feature of UPSERT. We’ve got loads of request popping in, both new and updates - so the UPSERT getting triggered alot. Today we faced a problem with integer within our app stating that the number is too high. We were like «WTF? Already?!»! After looking in to the features of UPSERT, we came to realize that any sequence will be incremented regardless of an insert being handled. This results then in an ID field being defined with ids such as:
1
2
5
19
222
73377
282828282
Etc. You get the point..
This design is so WTF and I have absolutely no idea why anyone would like their IDs to be generated and incremended even though there is no insert. I hope it is due to my naivity that I cannot comprhend it. Oh well. UPSERT, you’re forever gone 👍🔥

Comments
  • 0
    Postgres doesn't have an UPSERT.

    What it has is an INSERT ... ON CONFLICT UPDATE.

    And I agree that it is total cancer.
  • 0
    Upsert is the concept, not command - i know 👍😊 and it is totally rotten for sequence-based usage. Jeez louise :-/
Add Comment