Re: ALTER TABLE modifications

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Rod Taylor <pg(at)rbt(dot)ca>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: ALTER TABLE modifications
Date: 2003-11-12 19:02:20
Message-ID: Pine.LNX.4.44.0311121959560.32472-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Rod Taylor writes:

> ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol > 3);
> The above combinational syntax is commented out in gram.y. The
> support framework is used in both the above and below items, but
> arbitrary statements probably have some issues -- I've not
> tested enough to determine.
>
> If it is useful, it will be submitted at a later date.

I think it's perfectly fine to write two separate ALTER TABLE statements.
No need to introduce this nonstandard syntax.

> ALTER TABLE tab ALTER COLUMN col TYPE text TRANSFORM ...;
> Currently migrates indexes, check constraints, defaults, and the
> column definition to the new type with optional transform. If
> the tranform is not supplied, a standard assignment cast is
> attempted.

Please don't use the term "transform". It is used by the SQL standard for
other purposes. What kind of object would you put in place of the "..."
anyway? A function? What syntax do other databases use?

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-11-12 19:23:25 Re: ALTER TABLE modifications
Previous Message Tom Lane 2003-11-12 18:46:52 Re: 7.4RC2 regression failur and not running stats collector process on Solaris

Browse pgsql-patches by date

  From Date Subject
Next Message Rod Taylor 2003-11-12 19:23:25 Re: ALTER TABLE modifications
Previous Message Jason Tishler 2003-11-12 18:49:40 Re: "make check" improvement for cygwin