Re: BUG #13584: Upsert. The sequence value is increased.

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: av(dot)kostromin(at)gmail(dot)com
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13584: Upsert. The sequence value is increased.
Date: 2015-08-24 17:54:31
Message-ID: CAM3SWZQMfR6Zfe3A0Nr4ddko8xZrijAuQQ=EcGjGeJSs2piAXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Aug 22, 2015 at 11:25 AM, <av(dot)kostromin(at)gmail(dot)com> wrote:
> INSERT INTO t_tags_ident (tag_name, "comment")
> VALUES ('tag1','comment1'), ('tag2','comment2'), ('tag3','comment3'),
> ('tag4','comment4')
> ON CONFLICT (tag_name)
> DO UPDATE SET "comment" = EXCLUDED.comment
> RETURNING id
> there is the following problem. The sequence value is increased by the
> quantity of updated (conflict) rows, i.e. when I insert the new row its id
> is equal to the quantity of updated rows + 1. Is it OK for upsert?

This is the expected behavior. It is not a bug.

--
Peter Geoghegan

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message misha 2015-08-25 12:05:12 BUG #13585: After: yum install postgis2_95 - I've got error unsigned package
Previous Message Fabien COELHO 2015-08-22 19:30:52 Re: BUG #12379: pgbench should hint to pgbench -i