Re: how to implement add using upsert and trigger?

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: "yin(dot)zhb(at)163(dot)com" <yin(dot)zhb(at)163(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: how to implement add using upsert and trigger?
Date: 2022-11-28 12:47:37
Message-ID: CAFCRh-_GbmW_qS86eYshq7VrEYQ=Bvqr_W5_odPdwG+4FwkmOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 28, 2022 at 1:37 PM yin(dot)zhb(at)163(dot)com <yin(dot)zhb(at)163(dot)com> wrote:
> on conflict(itemid) do update
> set value = excluded.value + new.value, cnt = excluded.cnt +1 where excluded.itemid = new.itemid;

OT, but isn't `where excluded.itemid = new.itemid` redundant, given
`on conflict(itemid)`?
I'm asking more because I'm not sure, for my own education. Thanks, --DD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message yin.zhb@163.com 2022-11-28 12:57:58 Re: Re: how to implement add using upsert and trigger?
Previous Message yin.zhb@163.com 2022-11-28 12:37:37 how to implement add using upsert and trigger?