pgsql: Tighten integrity checks on ALTER TABLE ...

From: rhaas(at)postgresql(dot)org (Robert Haas)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Tighten integrity checks on ALTER TABLE ...
Date: 2010-02-01 19:28:56
Message-ID: 20100201192856.626C77541B9@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Tighten integrity checks on ALTER TABLE ... ALTER COLUMN ... RENAME.

When a column is renamed, we recursively rename the same column in
all descendent tables. But if one of those tables also inherits that
column from a table outside the inheritance hierarchy rooted at the
named table, we must throw an error. The previous coding correctly
prohibited the rename when the parent had inherited the column from
elsewhere, but overlooked the case where the parent was OK but a child
table also inherited the same column from a second, unrelated parent.

For now, not backpatched due to lack of complaints from the field.

KaiGai Kohei, with further changes by me.
Reviewed by Bernd Helme and Tom Lane.

Modified Files:
--------------
pgsql/src/backend/catalog:
pg_inherits.c (r1.5 -> r1.6)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/pg_inherits.c?r1=1.5&r2=1.6)
pgsql/src/backend/commands:
alter.c (r1.33 -> r1.34)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/alter.c?r1=1.33&r2=1.34)
analyze.c (r1.148 -> r1.149)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/analyze.c?r1=1.148&r2=1.149)
tablecmds.c (r1.320 -> r1.321)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.320&r2=1.321)
pgsql/src/backend/optimizer/prep:
prepunion.c (r1.179 -> r1.180)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/prepunion.c?r1=1.179&r2=1.180)
pgsql/src/include/catalog:
pg_inherits_fn.h (r1.2 -> r1.3)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_inherits_fn.h?r1=1.2&r2=1.3)
pgsql/src/include/commands:
tablecmds.h (r1.45 -> r1.46)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/tablecmds.h?r1=1.45&r2=1.46)
pgsql/src/test/regress/expected:
inherit.out (r1.31 -> r1.32)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/inherit.out?r1=1.31&r2=1.32)
pgsql/src/test/regress/sql:
inherit.sql (r1.15 -> r1.16)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/inherit.sql?r1=1.15&r2=1.16)

Browse pgsql-committers by date

  From Date Subject
Next Message User Gleu 2010-02-01 20:38:33 pgsnap - pgsnap: Add collation and ctype info in the databases report.
Previous Message Robert Haas 2010-02-01 17:28:28 Re: [COMMITTERS] pgsql: Augment EXPLAIN output with more details on Hash nodes.