Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Peter Geoghegan <pg(at)heroku(dot)com>, Casey Wireman <cwire4(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.
Date: 2016-05-07 16:43:17
Message-ID: CA+bJJbxyHtp1wuhCgngShrpkQ5byfFuO5tUAftf7GCEuTqJXOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, May 7, 2016 at 5:07 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Francisco Olarte <folarte(at)peoplecall(dot)com> writes:
>> 2.- IIRC using cache>1 can lead to obtain sequence numbers out of
>> order is using the same sequence in two different sessions.
......
>> so I think a note there could help.

> I think that's explained already, no?

Yes, it is. May be a little hard to find but it certainly is, my
fault. I've repeated my docs reading ( I did on the first reading ).
First I went to 8.1.3 datatypes/serial, which pointed me "see
nextval() in section 9.16 for details.". There I found "with default
parameters, successive nextval calls will return successive values
beginning with 1. Other behaviors can be obtained by using special
parameters in the CREATE SEQUENCE command; see its command reference
page for more information.". Then I rescaned that page AND missed the
Notes. My fault. A link to that note or to create sequence in the
nextval() page may be useful, but maybe I lost it because being
familiar with the behaviour I scanned too fast.

Francisco Olarte.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2016-05-07 19:08:08 Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.
Previous Message Tom Lane 2016-05-07 15:07:11 Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.