pgsql: ALTER TABLE ... - Mailing list pgsql-committers

From momjian@postgresql.org (Bruce Momjian)
Subject pgsql: ALTER TABLE ...
Date
Msg-id 20060702015836.D1B4F9FA634@postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
ALTER TABLE ... ADD/DROPS INHERIT (actually INHERIT / NO INHERIT)

Open items:

There were a few tangentially related issues that have come up that I think
are TODOs. I'm likely to tackle one or two of these next so I'm interested in
hearing feedback on them as well.

. Constraints currently do not know anything about inheritance. Tom suggested
  adding a coninhcount and conislocal like attributes have to track their
  inheritance status.

. Foreign key constraints currently do not get copied to new children (and
  therefore my code doesn't verify them). I don't think it would be hard to
  add them and treat them like CHECK constraints.

. No constraints at all are copied to tables defined with LIKE. That makes it
  hard to use LIKE to define new partitions. The standard defines LIKE and
  specifically says it does not copy constraints. But the standard already has
  an option called INCLUDING DEFAULTS; we could always define a non-standard
  extension LIKE table INCLUDING CONSTRAINTS that gives the user the option to
  request a copy including constraints.

. Personally, I think the whole attislocal thing is bunk. The decision about
  whether to drop a column from children tables or not is something that
  should be up to the user and trying to DWIM based on whether there was ever
  a local definition or the column was acquired purely through inheritance is
  hardly ever going to match up with user expectations.

. And of course there's the whole unique and primary key constraint issue. I
  think to get any traction at all on this you have a prerequisite of a real
  partitioned table implementation where the system knows what the partition
  key is so it can recognize when it's a leading part of an index key.

Greg Stark

Modified Files:
--------------
    pgsql/doc/src/sgml:
        ddl.sgml (r1.57 -> r1.58)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ddl.sgml.diff?r1=1.57&r2=1.58)
    pgsql/doc/src/sgml/ref:
        alter_table.sgml (r1.84 -> r1.85)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/alter_table.sgml.diff?r1=1.84&r2=1.85)
    pgsql/src/backend/commands:
        tablecmds.c (r1.188 -> r1.189)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c.diff?r1=1.188&r2=1.189)
    pgsql/src/backend/nodes:
        copyfuncs.c (r1.338 -> r1.339)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c.diff?r1=1.338&r2=1.339)
    pgsql/src/backend/parser:
        gram.y (r2.548 -> r2.549)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/gram.y.diff?r1=2.548&r2=2.549)
    pgsql/src/include/nodes:
        parsenodes.h (r1.312 -> r1.313)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h.diff?r1=1.312&r2=1.313)
    pgsql/src/test/regress/expected:
        alter_table.out (r1.94 -> r1.95)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/alter_table.out.diff?r1=1.94&r2=1.95)
    pgsql/src/test/regress/sql:
        alter_table.sql (r1.54 -> r1.55)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/alter_table.sql.diff?r1=1.54&r2=1.55)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix oversight in planning for multiple indexscans driven by
Next
From: momjian@postgresql.org (Bruce Momjian)
Date:
Subject: pgsql: Done: < o Add ALTER TABLE tab ADD/DROP INHERITS parent < <