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;