Re: type of a field

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: type of a field
Дата
Msg-id Pine.LNX.4.33.0205070946210.17503-100000@css120.ihs.com
обсуждение исходный текст
Ответ на type of a field  (ameen eetemadi <ameen78101@yahoo.com>)
Список pgsql-php
Short answer: You can't
Long answer: There are many workarounds.

Workaround 1:
dump the table with pg_dump dbase -t tablename
edit dump file to change table definition
drop and reload table.

Workaround 2:
Let's say you wanna change a varchar to a text type.

Original table t1:
col | type
----------
nam | varchar(32)
id  | int4

select nam::text, id into t2 from t1;
drop table t1;
alter table t2 rename to t1;

You can do the above in a transaction if you are on a live database.  I'd
back up the data first just to be sure.

On Tue, 7 May 2002, ameen eetemadi wrote:

> I want to change the type of a field in postgres .
> How can I do it ?
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


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

Предыдущее
От: "Duncan Adams (DNS)"
Дата:
Сообщение: Re: type of a field
Следующее
От: Dan Wilson
Дата:
Сообщение: Re: type of a field