Re: How to change column type in PostgreSQL 7.1.2

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Dennis Gearon <gearond(at)cvc(dot)net>
Cc: Vilson farias <vilson(dot)farias(at)digitro(dot)com(dot)br>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to change column type in PostgreSQL 7.1.2
Date: 2003-06-13 21:10:28
Message-ID: Pine.LNX.4.33.0306131510000.21088-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Please note that this is on 7.1.2, so the first thing Vilson should do is
upgrade to at least 7.2.4. THEN do all these things.

On Thu, 12 Jun 2003, Dennis Gearon wrote:

> drop key, Add a column, fill from old column, delete old column, rename
> new column to old name, add key.
>
> Watch out for indexes, functions, views, and especially referential
> constraints against that column. This is one reason why I always use a
> surrogate key.
>
> this Will only work if you have unique rows.
>
> Vilson farias wrote:
> >
> > Greetings,
> >
> > I'm wondering if there is a way to change a column type in PostgreSQL
> > 7.1.2 without reconstruction of table + pg_dump/restore of table data
> > (machine can't be stopped for a long time). I have a table with a integer
> > column and I would like to change it to varchar(20). One more thing, this
> > collumn belongs to a composed primary key. Is it possible?
> >
> > Best regards
> >
> > ----------------------------------------------------------------------------
> > ----
> > José Vilson de Mello de Farias
> > Software Engineer
> >
> > Dígitro Tecnologia Ltda - www.digitro.com.br
> > APC - Customer Oriented Applications
> > E-mail: vilson(dot)farias(at)digitro(dot)com(dot)br
> > Tel.: +55 48 281 7158
> > ICQ 11866179
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ernest E Vogelsinger 2003-06-13 21:14:43 Re: using sequences
Previous Message Bruno Wolff III 2003-06-13 21:08:36 Re: using sequences