| From: | armand pirvu <armand(dot)pirvu(at)gmail(dot)com> |
|---|---|
| To: | Peter Geoghegan <pg(at)bowt(dot)ie> |
| Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: upsert and update filtering |
| Date: | 2017-07-31 21:45:24 |
| Message-ID: | 7D07CFE1-BDE5-437D-B948-392F444EEAB6@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
aaaa
That's because the access on this case is done to the existing row using the table's name / alias , and to the rows that we attempt to insert using the excluded
Thank you Peter
Armand
> On Jul 31, 2017, at 4:31 PM, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>
> armand pirvu <armand(dot)pirvu(at)gmail(dot)com> wrote:
>> But what if in the conflict situation I want to performa the update ONLY if the record is different. The update seems to happen 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Marlowe | 2017-07-31 21:55:14 | Re: Manage slot in logical/pglogical replication |
| Previous Message | Peter Geoghegan | 2017-07-31 21:31:30 | Re: upsert and update filtering |