Re: [HACKERS] How to modify type in table?
От | Oliver Elphick |
---|---|
Тема | Re: [HACKERS] How to modify type in table? |
Дата | |
Msg-id | 200101301222.f0UCM5F17760@linda.lfix.co.uk обсуждение исходный текст |
Список | pgsql-sql |
"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 <dump). If the table is the target of RI references, triggers, rules and so on, it is easiest to use pg_dump to dump the whole database, (This is because the table is referenced by oid, not by name, and recreating the table will make it seem to disappear from all those references.) -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "The Lord knoweth how to deliver the godly out of temptations, and to reservethe unjust unto the day of judgment to be punished;" II Peter 2:9
В списке pgsql-sql по дате отправления: