Re: Identity columns should own only one sequence

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Identity columns should own only one sequence
Date: 2019-04-27 00:49:36
Message-ID: 20190427004936.GE2032@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-04-27 00:50:49 Re: Calling PrepareTempTablespaces in BufFileCreateTemp
Previous Message Michael Paquier 2019-04-27 00:44:20 Re: clean up docs for v12