Skip site navigation (1) Skip section navigation (2)

Re: change existing table definition

From: Johannes Lochmann <j(dot)lochmann(at)i-penta(dot)at>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: change existing table definition
Date: 2005-06-28 14:26:19
Message-ID: 200506281626.20138.j.lochmann@i-penta.at (view raw or flat)
Thread:
Lists: pgsql-admin
On Tuesday 28 June 2005 15:27, Chuming Chen wrote:

Hello,

> How can I change the column definition of an existing table, ie. from
> varchar(30) to varchar(50)? 

You did not mention any version, so for 8.0.x:

alter table t alter col type varchar(50);

> Is there any way to add a new column to an 
> existing table?

alter table t add colum foo varchar(127)

Link tip:

http://www.postgresql.org/docs/8.0/interactive/ddl-alter.html

HTH

Johannes

In response to

pgsql-admin by date

Next:From: Michael FuhrDate: 2005-06-28 14:31:06
Subject: Re: change existing table definition
Previous:From: Peter EisentrautDate: 2005-06-28 14:14:25
Subject: Re: change existing table definition

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group