Re: [HACKERS] How to modify type in table?

Поиск
Список
Период
Сортировка
Искать

Re: [HACKERS] How to modify type in table?

От:
"Oliver Elphick" <olly@lfix.co.uk>
Дата:
"Jaruwan Laongmal" wrote: >Would you like to inform me how to modify type in table? >For example , I define type as varchar(14) , but I want to modify to varcha= >r(120). How to do this.

There is no facility to do this directly.  (Allowing columns to change
their type would possibly involve rewriting the entire table.)

You can use pg_dump to dump either a database or a particular table. Then
you can edit the CREATE TABLE command in the dump output and then create a
new database or table from the dump.

If the table in question is not referenced by any other objects, dump
it  (pg_dump -t table database >dump); edit the dump; delete or rename the
old table; and finally restore the dump (psql -d database 
FAQ