Re: future of serial and identity columns

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: future of serial and identity columns
Date: 2022-10-12 08:05:05
Message-ID: 20221012080505.hbqtvhfu5t472snn@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022-Oct-11, Peter Eisentraut wrote:

> diff --git a/src/test/modules/test_ddl_deparse/expected/alter_table.out b/src/test/modules/test_ddl_deparse/expected/alter_table.out
> index 87a1ab7aabce..30e3dbb8d08a 100644
> --- a/src/test/modules/test_ddl_deparse/expected/alter_table.out
> +++ b/src/test/modules/test_ddl_deparse/expected/alter_table.out
> @@ -25,12 +25,9 @@ NOTICE: DDL test: type simple, tag CREATE TABLE
> CREATE TABLE grandchild () INHERITS (child);
> NOTICE: DDL test: type simple, tag CREATE TABLE
> ALTER TABLE parent ADD COLUMN b serial;
> -NOTICE: DDL test: type simple, tag CREATE SEQUENCE
> -NOTICE: DDL test: type alter table, tag ALTER TABLE
> -NOTICE: subcommand: type ADD COLUMN (and recurse) desc column b of table parent
> -NOTICE: DDL test: type simple, tag ALTER SEQUENCE
> +ERROR: cannot recursively add identity column to table that has child tables

I think this change merits some discussion. Surely we cannot simply
disallow SERIAL from being used with inheritance. Do we need to have
a way for identity columns to be used by children tables?

(My first thought was "let's keep SERIAL as the old code when used for
inheritance", but then I realized that the parent table starts as a
normal-looking table that only later acquires inheritors, so we wouldn't
know ahead of time that we need to treat that SERIAL column in a special
way.)

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"La vida es para el que se aventura"

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2022-10-12 08:09:46 Re: Tracking last scan time
Previous Message Michael Paquier 2022-10-12 08:04:11 Re: Use extended statistics to estimate (Var op Var) clauses