ALTER TABLE TODO items

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)svr1(dot)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: ALTER TABLE TODO items
Date: 2004-05-05 14:36:36
Message-ID: 200405051436.i45Eaa521774@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers


TODO items completed:

o -ALTER TABLE ADD COLUMN does not honor DEFAULT and non-CHECK CONSTRAINT
o -ALTER TABLE ADD COLUMN column DEFAULT should fill existing
rows with DEFAULT value
o -Allow ALTER TABLE to modify column lengths and change to binary
compatible types

Seems we didn't have ALTER COLUMN TYPE on the TODO list.

Do we still want this TODO?

o Allow columns to be reordered using ALTER ... POSITION i col1 [,col2];
have SELECT * and INSERT honor such ordering

I don't think so. As I remember it was part of doing logical attribute
numbers as a way to add ALTER COLUMN TYPE, but because we now use table
recreate to implement this, it is unlikely we will ever add logical
attribute numbers (adds too much complexity to the code).

---------------------------------------------------------------------------

Tom Lane wrote:
> CVSROOT: /cvsroot
> Module name: pgsql-server
> Changes by: tgl(at)svr1(dot)postgresql(dot)org 04/05/05 01:48:48
>
> Modified files:
> doc/src/sgml/ref: alter_table.sgml
> src/backend/bootstrap: bootparse.y
> src/backend/catalog: dependency.c heap.c index.c
> src/backend/commands: cluster.c indexcmds.c tablecmds.c
> src/backend/nodes: copyfuncs.c equalfuncs.c
> src/backend/parser: analyze.c gram.y
> src/backend/tcop: utility.c
> src/backend/utils/adt: ruleutils.c
> src/include/catalog: dependency.h heap.h index.h
> src/include/commands: cluster.h defrem.h tablecmds.h
> src/include/nodes: nodes.h parsenodes.h
> src/include/parser: analyze.h
> src/include/utils: builtins.h
> src/test/regress/expected: alter_table.out foreign_key.out
> inherit.out
> src/test/regress/sql: alter_table.sql foreign_key.sql
> inherit.sql
>
> Log message:
> ALTER TABLE rewrite. New cool stuff:
>
> * ALTER ... ADD COLUMN with defaults and NOT NULL constraints works per SQL
> spec. A default is implemented by rewriting the table with the new value
> stored in each row.
>
> * ALTER COLUMN TYPE. You can change a column's datatype to anything you
> want, so long as you can specify how to convert the old value. Rewrites
> the table. (Possible future improvement: optimize no-op conversions such
> as varchar(N) to varchar(N+1).)
>
> * Multiple ALTER actions in a single ALTER TABLE command. You can perform
> any number of column additions, type changes, and constraint additions with
> only one pass over the table contents.
>
> Basic documentation provided in ALTER TABLE ref page, but some more docs
> work is needed.
>
> Original patch from Rod Taylor, additional work from Tom Lane.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Meskes 2004-05-05 15:03:05 pgsql-server/src/interfaces/ecpg ChangeLog ecp ...
Previous Message Bruce Momjian 2004-05-05 14:36:20 pgsql-server/doc TODO

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2004-05-05 15:05:28 Re: Multiple Xids in PGPROC?
Previous Message Rod Taylor 2004-05-05 14:24:54 Re: PostgreSQL pre-fork speedup