pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Haller <ch@rodos.fzk.de>
To: pgsql-sql@postgresql.org
Cc: atul@imcindia.net
Subject: Re: How to increase Column width of table
Date: Tue, 25 Mar 2003 16:18:11 +0100
Message-ID: <3E807332.9C5EBEE@rodos.fzk.de> (raw)

>
>  Atul here, i have one table and i would like to increase the length
of
>  existing column and the sql statement is
>
>        Exisiting Column  is "vehicle_make"  varchar(30)
>
>        SQL: alter table commute_profile alter column "vehicle_make"
> varchar(100)
>
>        But this gives error.
>
>        ERROR:  parser: parse error at or near "varchar"
>
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




view thread (5+ messages)  latest in thread

Message-ID: <3E807332.9C5EBEE@rodos.fzk.de>
Permalink:  ../3E807332.9C5EBEE@rodos.fzk.de/
Also on:    postgresql.org/message-id/3E807332.9C5EBEE@rodos.fzk.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: ch@rodos.fzk.de, atul@imcindia.net
  Subject: Re: How to increase Column width of table
  In-Reply-To: <3E807332.9C5EBEE@rodos.fzk.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