Re: Behavior of identity columns - Mailing list pgsql-general

From Francisco Olarte
Subject Re: Behavior of identity columns
Date
Msg-id CA+bJJbyiMovsrqZmouLMSbFviVkteJdMTEGnRCwZ_w2Gk1icEg@mail.gmail.com
Whole thread Raw
In response to Re: Behavior of identity columns  ("sivapostgres@yahoo.com" <sivapostgres@yahoo.com>)
List pgsql-general
On Thu, 4 Aug 2022 at 10:52, sivapostgres@yahoo.com
<sivapostgres@yahoo.com> wrote:
> I see 'identity' column values increment even when some error(s) occurs while inserting data.  Is that a known bug or
knownbehavior?
 

Known behaviour, explained thousand of times over the years.  Identity
is not a way to generate consecutive values, not ever guaranteed
ascending values, it is for generating unique values. The
implementation burn the values before commit/rollback for better
concurreency, search archives or docs for details. In your example, id
is allocated and burnt to generate the complete failing row, when it
fails it is gone. Search lists, google, the docs, its been explained
ad nauseam.

Francisco Olarte.



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: How to choose new master from slaves.?
Next
From: "David G. Johnston"
Date:
Subject: Re: Index only scans for expressional indices when querying for the expression