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"