Re: UPDATE OR REPLACE? - Mailing list pgsql-general

From Michael Paquier
Subject Re: UPDATE OR REPLACE?
Date
Msg-id CAB7nPqRnwqj=OEH4mekhdc=TH3PRVX4qrji97nksPDxnihKBig@mail.gmail.com
Whole thread Raw
In response to UPDATE OR REPLACE?  ("dandl" <david@andl.org>)
Responses Re: UPDATE OR REPLACE?
List pgsql-general
On Thu, Sep 1, 2016 at 12:10 PM, dandl <david@andl.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


pgsql-general by date:

Previous
From: Venkata B Nagothi
Date:
Subject: Re: Vacuum Full - Questions
Next
From: Gary Evans
Date:
Subject: Re: Vacuum Full - Questions