[KLUG Members] PostgreSQL field resize?

Buist Justin members@kalamazoolinux.org
Mon, 15 Jul 2002 13:40:21 -0400


Oops... I forgot my lazy-man's way:

pg_dump dbname > db.sql
... edit db.sql, save schema changes.
dropdb dbname && createdb dbname && psql dbname < db.sql

... Takes a while to run sometimes, but it's easier on the cranium.

Justin Buist


> -----Original Message-----
> From: Buist Justin 
> Sent: Monday, July 15, 2002 1:36 PM
> To: members@kalamazoolinux.org
> Subject: RE: [KLUG Members] PostgreSQL field resize?
> 
> 
> It's a bit crufty, but here's the only way I know of to do it:
> 
> a)  Create a new table that reflects your new desired schema.
> b)  Follow instructions at: 
> http://www.us.postgresql.org/docs/faq-english.html#4.4 which 
> shows you how to copy data from an old table into a new one 
> then drop the old one and rename the new one to the old one.  
> Wow, that sounds ugly.
> 
> If you've got any foreign keys setup pointing to the existing 
> table you wish to change you'll have to drop those 
> constraints during the entire process.  
> 
> Hope that helps.
> 
> Justin Buist
> 
> 
> > -----Original Message-----
> > From: Kevin Mitchell [mailto:kevin@godzilla.iserv.net]
> > Sent: Monday, July 15, 2002 1:27 PM
> > To: members@kalamazoolinux.org
> > Subject: [KLUG Members] PostgreSQL field resize?
> > 
> > 
> > Hiya,
> > 
> > Does anyone know if you can rezise the length of a field in a 
> > PostgreSQL
> > database?
> > 
> > I have something like this:
> > 
> > Field		Type		Length
> > -----		-----		------
> > username	varchar()	8
> > 
> > and I'd like to make 8 to be a longer value (ie: 32).
> > 
> > TIA,
> > 
> > Kevin
> > 
> > _______________________________________________
> > Members mailing list
> > Members@kalamazoolinux.org
> > 
> > 
> _______________________________________________
> Members mailing list
> Members@kalamazoolinux.org
> 
>