pgsql: Tighten integrity checks on ALTER TABLE ... - Mailing list pgsql-committers

From rhaas@postgresql.org (Robert Haas)
Subject pgsql: Tighten integrity checks on ALTER TABLE ...
Date
Msg-id 20100201192856.626C77541B9@cvs.postgresql.org
Whole thread Raw
List 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)

pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: Augment EXPLAIN output with more details on Hash nodes.
Next
From: gleu@pgfoundry.org (User Gleu)
Date:
Subject: pgsnap - pgsnap: Add collation and ctype info in the databases report.