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

From Tom Lane
Subject Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.
Date
Msg-id 2186.1462633631@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.  (Francisco Olarte <folarte@peoplecall.com>)
Responses Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.
List pgsql-bugs
Francisco Olarte <folarte@peoplecall.com> writes:
> But I've read the docs and noticed the warning:

> "Important: To avoid blocking concurrent transactions that obtain
> numbers from the same sequence, a nextval operation is never rolled
> back; that is, once a value has been fetched it is considered used,
> even if the transaction that did the nextval later aborts. This means
> that aborted transactions might leave unused "holes" in the sequence
> of assigned values."

> Which may lead people to think only rollbacks 'burn' numbers.

Yeah, good point.  I'll do some wordsmithing on that.

> 2.- IIRC using cache>1 can lead to obtain sequence numbers out of
> order is using the same sequence in two different sessions. I assumed
> this is normal and do not have a problem with it, but people may get
> surprised by it, so I think a note there could help.

I think that's explained already, no?

            regards, tom lane

pgsql-bugs by date:

Previous
From: digoal@126.com
Date:
Subject: BUG #14129: Why GIN index not use index scan?
Next
From: Francisco Olarte
Date:
Subject: Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.