[KLUG Members] PostgreSQL field resize?

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


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
> 
>