pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nick Fankhauser <nickf@ontko.com>
To: suresh@mithi.com
To: pgsql-sql@postgresql.org
Subject: Re: Need to change the size of a field
Date: Mon, 18 Feb 2002 08:56:14 -0500
Message-ID: <NEBBLAAHGLEEPCGOBHDGMEPNEFAA.nickf@ontko.com> (raw)
In-Reply-To: <NFBBKGHMBKLDMDLMGGHBEENCCNAA.suresh@mithi.com>

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
>




view thread (4+ messages)  latest in thread

Message-ID: <NEBBLAAHGLEEPCGOBHDGMEPNEFAA.nickf@ontko.com>
Permalink:  ../NEBBLAAHGLEEPCGOBHDGMEPNEFAA.nickf@ontko.com/
Also on:    postgresql.org/message-id/NEBBLAAHGLEEPCGOBHDGMEPNEFAA.nickf@ontko.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: nickf@ontko.com, suresh@mithi.com
  Subject: Re: Need to change the size of a field
  In-Reply-To: <NEBBLAAHGLEEPCGOBHDGMEPNEFAA.nickf@ontko.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox