Re: future of serial and identity columns

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: future of serial and identity columns
Date: 2022-10-04 09:33:15
Message-ID: 5859a8570afb08c86cc64dd4896b081a23586e16.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2022-10-04 at 09:41 +0200, Peter Eisentraut wrote:
> In PostgreSQL 10, we added identity columns, as an alternative to serial
> columns (since 6.something).  They mostly work the same.  Identity
> columns are SQL-conforming, have some more features (e.g., overriding
> clause), and are a bit more robust in schema management.  Some of that
> was described in [0].  AFAICT, there have been no complaints since that
> identity columns lack features or are somehow a regression over serial
> columns.
>
> But clearly, the syntax "serial" is more handy, and most casual examples
> use that syntax.  So it seems like we are stuck with maintaining these
> two variants in parallel forever.  I was thinking we could nudge this a
> little by remapping "serial" internally to create an identity column
> instead.  At least then over time, the use of the older serial
> mechanisms would go away.

I think that would be great.
That might generate some confusion among users who follow old tutorials
and are surprised that the eventual table definition differs, but I'd say
that is a good thing.

Yours,
Laurenz Albe

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dagfinn Ilmari Mannsåker 2022-10-04 09:35:25 Re: Miscellaneous tab completion issue fixes
Previous Message vignesh C 2022-10-04 09:30:10 Re: Miscellaneous tab completion issue fixes