Re: BUG #13584: Upsert. The sequence value is increased. - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: BUG #13584: Upsert. The sequence value is increased.
Date
Msg-id CAM3SWZQMfR6Zfe3A0Nr4ddko8xZrijAuQQ=EcGjGeJSs2piAXA@mail.gmail.com
Whole thread Raw
In response to BUG #13584: Upsert. The sequence value is increased.  (av.kostromin@gmail.com)
List pgsql-bugs
On Sat, Aug 22, 2015 at 11:25 AM,  <av.kostromin@gmail.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

pgsql-bugs by date:

Previous
From: av.kostromin@gmail.com
Date:
Subject: BUG #13584: Upsert. The sequence value is increased.
Next
From: Nick Barnes
Date:
Subject: Re: BUG #13581: pg_dump omits extension versions