Re: Add column - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Add column
Date
Msg-id 20060811165824.GD950@svana.org
Whole thread Raw
In response to Add column  (Ioannis Theoharis <theohari@ics.forth.gr>)
List pgsql-general
On Fri, Aug 11, 2006 at 07:35:29PM +0300, Ioannis Theoharis wrote:
>
>
> Hi, there is a feature that I would be glad if it was supported by
> PostgreSQL:
>
> I want to add a new column (attribute) to a pre-existed table, but instead
> of filling the values of this column with a default value (e.g. null) I
> would like to copy them from a file stored in my filesystem.
>
> I didn't find any example of mixing "copy" and "alter table ... add
> column" in the Documentation, however I send this mail to check it out.

That's because it doesn't make any sense. How does the alter table know
which row in the copy matches which row in the table? It's means you
need to do a join, at which point it would be easier to just copy into
a temp table and do an update to set the values.

alter table doesn't really have any magic in it w.r.t. setting the
default value.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: VACUUM VERBOSE output to STDERR
Next
From: "Joshua D. Drake"
Date:
Subject: Re: How to use the full text index feature on PostgreSQL