| From: | Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: How to increase Column width of table |
| Date: | 2003-03-25 16:50:41 |
| Message-ID: | 3E8088E1.5030700@web.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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(at)postgresql(dot)org
>
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Josh Berkus | 2003-03-25 17:31:27 | Does anyone use TO_CHAR(INTERVAL)? |
| Previous Message | Robert Treat | 2003-03-25 16:46:30 | Re: How to increase Column width of table |