Re: Identity columns should own only one sequence - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Identity columns should own only one sequence
Date
Msg-id 20190427004936.GE2032@paquier.xyz
Whole thread Raw
In response to Re: Identity columns should own only one sequence  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Fri, Apr 26, 2019 at 11:55:34AM -0400, Alvaro Herrera wrote:
> On 2019-Apr-26, Laurenz Albe wrote:
> I think a better overall fix is that that when creating the generated
> column (or altering a column to make it generated) we should look for
> existing an existing sequence and take ownership of that (update
> pg_depend records), before deciding to create a new sequence.

What that be actually right?  The current value of the sequence would
be the one from the previous use, and max/min values may not be the
defaults associated with identity columns, which is ranged in
[-2^31,2^31-1] by default, but the sequence you may attempt (or not)
to attach to could have completely different properties.  It seems to
me that it is much better to start afresh and not enforce the sequence
into something that the user may perhaps not want to use.

My 2c.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: clean up docs for v12
Next
From: Michael Paquier
Date:
Subject: Re: Calling PrepareTempTablespaces in BufFileCreateTemp