Re: Add column

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Add column
Дата
Msg-id 20060811165824.GD950@svana.org
обсуждение исходный текст
Ответ на Add column  (Ioannis Theoharis <theohari@ics.forth.gr>)
Список 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.

Вложения

В списке pgsql-general по дате отправления: