From: yin.zhb@163.com <yin.zhb@163.com>
To: Dominique Devienne <ddevienne@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Re: how to implement add using upsert and trigger?
Date: Mon, 28 Nov 2022 20:57:58 +0800
Message-ID: <202211282057577060707@163.com> (raw)
References: <202211282037367351626@163.com>
<CAFCRh-_GbmW_qS86eYshq7VrEYQ=Bvqr_W5_odPdwG+4FwkmOQ@mail.gmail.com>
em, which is does not matter
yin.zhb@163.com
From: Dominique Devienne
Date: 2022-11-28 20:47
To: yin.zhb@163.com
CC: pgsql-general
Subject: Re: how to implement add using upsert and trigger?
On Mon, Nov 28, 2022 at 1:37 PM yin.zhb@163.com <yin.zhb@163.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: yin.zhb@163.com, ddevienne@gmail.com
Subject: Re: how to implement add using upsert and trigger?
In-Reply-To: <202211282057577060707@163.com>
References: <202211282037367351626@163.com> <CAFCRh-_GbmW_qS86eYshq7VrEYQ=Bvqr_W5_odPdwG+4FwkmOQ@mail.gmail.com> <202211282057577060707@163.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox