Re: Need to change the size of a field - Mailing list pgsql-sql

From Nick Fankhauser
Subject Re: Need to change the size of a field
Date
Msg-id NEBBLAAHGLEEPCGOBHDGMEPNEFAA.nickf@ontko.com
Whole thread Raw
In response to Need to change the size of a field  (<suresh@mithi.com>)
List pgsql-sql
I don't think you can alter a column in the current version, but here's an
example of a workaround that should do the job:

create table change_me (id int, text varchar(20));

[Then I add some data & decide I need to widen the text field without losing
the data.]

create table temp_change_me as select * from change_me;

drop table change_me;

create table change_me (id int, text varchar(50));

insert into change_me (id, text) (select id, text from temp_change_me);

drop table temp_change_me;

hth, Nick



> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of suresh@mithi.com
> Sent: Monday, February 18, 2002 8:31 AM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Need to change the size of a field
>
>
> Hi
>
> I have a table with one of the fields as a varchar(32) field.
> This table has
> about 100,000 records.
> I want to increase the size of the varchar field to 64. How can
> this be done
> without affecting the data already present  ?
> Thanx in advance.
> regards
> suresh
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>



pgsql-sql by date:

Previous
From:
Date:
Subject: Need to change the size of a field
Next
From: Shane Wright
Date:
Subject: table locking