Re: changing the size of a column without losing data

From: Aarni Ruuhimäki / Megative Tmi / KYMI(dot)com <aarni(dot)ruuhimaki(at)kymi(dot)com>
To: "Mark Seftel" <mark(at)trustemail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: changing the size of a column without losing data
Date: 2002-08-23 07:52:01
Message-ID: 20020823075428.FSVT26596.fep08.tmt.tele.fi@there
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi !

One quick way to do this is to take a dump from your x_db. Edit the dump file
and change your field's defition from character varying(100) to character
varying (50)

Make sure the data is valid for this shorter field. Drop your x_db. Create a
new empty x_db. Read the dump in the new x_db.

BR,

aarni

On Thursday 22 August 2002 08:43 pm, you wrote:
> hi,
>
> How would i change a field which is currently char100 to char50?
>
> have tried:
> ALTER TABLE outlets MODIFY description varchar(50);
>
> but get error:
> parser: parse error at or near "modify"
>
> what is the correct command.
>
> Thx
>
> Mark
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-08-23 16:18:02 Re: Simple but slow
Previous Message paul butler 2002-08-23 07:06:12 Re: changing the size of a column without losing data