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

Re: User Management

From: Nabil Sayegh <nsmail(at)sayegh(dot)de>
To: Giorgio "A(dot)" <jh(at)libero(dot)it>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: User Management
Date: 2001-07-05 11:22:42
Message-ID: 994332162.2966.1.camel@billy.labor.localnet (view raw or flat)
Thread:
Lists: pgsql-novice
On 05 Jul 2001 11:09:29 +0200, Giorgio A. wrote:
> hi, i have this very lame problem: i created a column as varchar(15) but now
> i need to have more than 15 char... how can i change this ? changing it into
> "text" will also be good !

You can't change the type of fields.
You could create a new table with proper cols and 'INSERT INTO newtable
SELECT * FROM oldtable;DROP TABLE oldtable;ALTER TABLE newtable RENAME
TO oldtable;' or something like that.

This leaves you in a mess if there are triggers involved (references
etc.) 

I would suggest you 'pg_dump -D dbname > db.sql' modify the table
definitions, 'dropdb dbname;createdb dbname;psql dbname -f db.sql'
(If you can live with a short downtime and loosing some information like
oids, but that should be irrelevant in most cases) 

cu

--
 Nabil Sayegh



In response to

pgsql-novice by date

Next:From: Nabil SayeghDate: 2001-07-05 11:22:53
Subject: Re: User Management
Previous:From: Nabil SayeghDate: 2001-07-05 11:22:28
Subject: Re: User Management

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