From: | Johan Nel <johan(dot)nel(at)xsinet(dot)co(dot)za> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: add column specify position |
Date: | 2010-02-03 05:32:06 |
Message-ID: | hkb1pd$b5e$1@news.eternal-september.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Scott
Scott Frankel wrote:
>
> Hi all,
>
> Is it possible to specify a position when adding a column to a table?
No not AFAIK.
> I want to swap one column for another without losing the column's
> position. eg: given that 'foo' is the 5th column in an 8 column table,
> I want to replace it with a 'bar' column at column 5.
>
> ALTER TABLE qwe DROP COLUMN foo;
> ALTER TABLE qwe ADD COLUMN bar;
ALTER TABLE qwe RENAME COLUMN foo TO bar;
That does imply the COLUMN TYPE stays the same though... The help file
does have examples in the ALTER TABLE section how to change the TYPE of a
column.
HTH,
Johan Nel
Pretoria, South Africa.
From | Date | Subject | |
---|---|---|---|
Next Message | dipti shah | 2010-02-03 06:28:16 | Re: Questions on PostGreSQL Authentication mechanism... |
Previous Message | Scott Frankel | 2010-02-03 05:14:13 | add column specify position |