pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Pflug <Andreas.Pflug@web.de>
To: pgsql-sql@postgresql.org
Subject: Re: How to increase Column width of table
Date: Tue, 25 Mar 2003 17:50:41 +0100
Message-ID: <3E8088E1.5030700@web.de> (raw)
In-Reply-To: <3E807332.9C5EBEE@rodos.fzk.de>
References: <3E807332.9C5EBEE@rodos.fzk.de>

Christoph Haller wrote:

>I'm afraid there is no one-step-solution to this.
>You'll have to go the hard way as
>
>CREATE new_table (
>...
>... varchar(100),
>...
>);
>INSERT INTO new_table as SELECT * FROM old_table;
>DROP old_table;
>ALTER TABLE new_table RENAME TO old_table;
>And don't forget about re-creating related indexes etc.
>
>Regards, Christoph
>  
>
This has many side effects, like dropped indices that have to be 
recreated etc.
You can rename your old column, create a new column varchar(100), update 
... set newCol=oldCol, drop oldCol and rename newCol to oldCol
See ALTER TABLE doc for this.

>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>  
>




view thread (5+ messages)  latest in thread

Message-ID: <3E8088E1.5030700@web.de>
Permalink:  ../3E8088E1.5030700@web.de/
Also on:    postgresql.org/message-id/3E8088E1.5030700@web.de

 · 

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: Andreas.Pflug@web.de
  Subject: Re: How to increase Column width of table
  In-Reply-To: <3E8088E1.5030700@web.de>

* 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