Re: UPDATE OR REPLACE?

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: dandl <david(at)andl(dot)org>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: UPDATE OR REPLACE?
Date: 2016-09-01 04:03:16
Message-ID: CAB7nPqRnwqj=OEH4mekhdc=TH3PRVX4qrji97nksPDxnihKBig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 1, 2016 at 12:10 PM, dandl <david(at)andl(dot)org> wrote:
> Sqlite has options to handle an update that causes a duplicate key. Is there
> anything similar in Postgres?
> This is not an UPSERT. The scenario is an UPDATE that changes some key field
> so that there is now a duplicate key. In Sqlite this handled as:
> UPDATE OR IGNORE table SET <etc>
> UPDATE OR REPLACE table SET <etc>
>
> And so on
>
> See https://www.sqlite.org/lang_update.html.
>
> Can Postgres do this?

Somewhat with a plpgsql function, but with a native UPDATE query, the
answer is no.
--
Michael

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gary Evans 2016-09-01 04:17:52 Re: Vacuum Full - Questions
Previous Message Venkata B Nagothi 2016-09-01 03:57:13 Re: Vacuum Full - Questions