Re: Changing the type of a column in an already populated
| От | scott.marlowe |
|---|---|
| Тема | Re: Changing the type of a column in an already populated |
| Дата | |
| Msg-id | Pine.LNX.4.33.0211220902330.25220-100000@css120.ihs.com обсуждение исходный текст |
| Ответ на | Re: Changing the type of a column in an already populated database. (Brian Minton <bminton@efn.org>) |
| Список | pgsql-general |
On Thu, 21 Nov 2002, Brian Minton wrote: > David Pradier wrote: > > Hi! > > > > I'd like to know if it is possible to change the type of a column to a > > compatible one, in an already populated database. > > For example, changing a column from varchar(20) to varchar(25) ? > > I'm using postgresql 7.3rc1 > > > > Thanks for your help. > > > > Best regards, > > David > > dump the database, edit the dump file, and reload. of course, this is > annonying on live data, but it works The other method, which works well on tables with no triggers or fks or anything, which is common when you're first building tables and such: create table test (name varchar(20), id int, bucks numeric(12,2)); (insert some data, play around...) begin; select name::varchar(32), id, bucks into test2 from test; drop table test; alter table test2 rename to test; commit;
В списке pgsql-general по дате отправления: