Re: Duplicate key error

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: yudhi s <learnerdatabase99(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Duplicate key error
Date: 2024-11-11 20:04:43
Message-ID: CAH2-Wz=bSrxrEF_xsz+jLgiqQqE=n2_PZPe-GzRsSz6k6-Vr9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 11, 2024 at 12:41 AM yudhi s <learnerdatabase99(at)gmail(dot)com> wrote:
> So it means it will ensure no duplication happens for ID values, but still we are seeing "duplicate key" error. So what is the possible reason here or are we encountering any buggy behaviour here?

MERGE doesn't actually make any promises about not getting unique
violations. Only ON CONFLICT DO UPDATE (and ON CONFLICT DO NOTHING)
make such a promise. That's the main reason why Postgres supports
both.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michel Pelletier 2024-11-11 21:27:12 Re: Using Expanded Objects other than Arrays from plpgsql
Previous Message yudhi s 2024-11-11 18:50:07 Re: Duplicate key error