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

Re: changing data type

From: "D(dot) Duccini" <duccini(at)backpack(dot)com>
To: Chris <csmith(at)squiz(dot)net>
Cc: pgsql-novice(at)hub(dot)org
Subject: Re: changing data type
Date: 2000-10-19 05:35:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
can't do it (in 6.x)

the best you can do is

alter table rename column1 to oldcolumn1

alter table add column1 attr type;

then insert into it from the old one

alternately, dump the data out, and reload into your new table

On Thu, 19 Oct 2000, Chris wrote:

> Hi all,
> I tried to do a search for this, but couldn't find anything.
> How do I change a datatype in postgres?
> eg, change a column from being "text" to "varchar".
> Thanks
> ------------------------
> Chris Smith

david(at)backpack(dot)com            BackPack Software, Inc.
+1 651.645.7550 voice       "Life is an Adventure.    
+1 651.645.9798 fax            Don't forget your BackPack!"   

In response to


pgsql-novice by date

Next:From: ChrisDate: 2000-10-19 06:18:09
Subject: changing data type
Previous:From: Tom LaneDate: 2000-10-19 01:40:00
Subject: Re: data dictionary?

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