From: | Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il> |
---|---|
To: | Lorenzo Huerta <lorhuerta(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgreSQL(dot)org |
Subject: | Re: [GENERAL] Is it possible to drop a column? |
Date: | 1998-09-14 10:45:56 |
Message-ID: | l03110701b222a338e700@[147.233.159.109] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
At 21:25 +0200 on 13/9/98, Lorenzo Huerta wrote:
> Well this should also work as well, and it will reduce the heartache.
>
> say you have a table foo, with columns A,B,C already created. Then
> you want to remove column C as you don't need the data anymore.
>
> So you can do this:
>
> select A,B into table bar from foo, and it will create a brand new
> table called bar , with the attribs for A & B the same as in foo, of
> course with all your data included.
One must remember, however, that this table does not retain any defaults or
constraints from the original table, nor does it have any indices.
While it is easy to define indices after the table is already created and
filled, default and constraints are another story altogether.
So, if your original table has them, the method that defines the new table
first, and copies the data later, is the preferred method.
I find that SELECT INTO TABLE is good mostly for the creation of temporary
tables.
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Ansley | 1998-09-14 12:00:00 | DB Design Tools |
Previous Message | Lincoln Spiteri | 1998-09-14 10:16:54 | Readin money type into java BigDecimals |