Re: [GENERAL] upsert and update filtering - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: [GENERAL] upsert and update filtering
Date
Msg-id 20170731213130.GA25306@marmot
Whole thread Raw
In response to [GENERAL] upsert and update filtering  (armand pirvu <armand.pirvu@gmail.com>)
Responses Re: [GENERAL] upsert and update filtering
List pgsql-general
armand pirvu <armand.pirvu@gmail.com> wrote:
>But what if in the conflict situation I want to performa the update ONLY if the record is different. The update seems
tohappen no matter what 
>In other words is there anyway I can filter the update to happen (based on the sample date) only for 112 since col2 is
different? 

That's quite possible. An ON CONFLICT's UPDATE accepts a WHERE clause,
which can reference both existing and excluded tuples. That WHERE clause
can back out of the UPDATE based on whatever criteria you like.

--
Peter Geoghegan


pgsql-general by date:

Previous
From: armand pirvu
Date:
Subject: [GENERAL] upsert and update filtering
Next
From: armand pirvu
Date:
Subject: Re: [GENERAL] upsert and update filtering