Re: how to chane the type

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com>, "tinar" <tinarajraj(at)hotmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: how to chane the type
Date: 2001-12-07 01:45:35
Message-ID: GNELIHDDFBOCMGBFGEFOMEKMCAAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

What's the essential problem with changing column types in postgres? Is it
similar to the DROP COLUMN problem?

If the answer is that the table format only has allocated enough space per
row for the existing type, then how is it possible that Stephen's hack below
will not break things?

Chris

> -----Original Message-----
> From: pgsql-sql-owner(at)postgresql(dot)org
> [mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of Stephan Szabo
> Sent: Friday, 7 December 2001 12:31 AM
> To: tinar
> Cc: pgsql-sql(at)postgresql(dot)org
> Subject: Re: [SQL] how to chane the type
>
>
>
> On Wed, 5 Dec 2001, tinar wrote:
>
> > i have created a table
> > userlist with fields username varchar(10)
> > now i want to change it to username varchar(30)
> > without dropping or recreating the table.
> > how do i do it?
>
> The best way is to recreate the table and rename
> them around. If you *REALLY* don't want to do
> that and have a recent backup (yes, I'm serious),
> you can muck with pg_attribute and change
> atttypmod for the attribute in question
> (from 14 to 34).
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2001-12-07 02:05:14 Re: how to chane the type
Previous Message Tatsuo Ishii 2001-12-07 00:13:34 Re: Intermediate report for AIX 5L port

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2001-12-07 02:05:14 Re: how to chane the type
Previous Message Larry Rosenman 2001-12-06 23:36:28 Trigger for logging stuff...