Re: how to chane the type

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


On Fri, 7 Dec 2001, Christopher Kings-Lynne wrote:

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

The hack below only works to change the max length of variable length
attributes and only upward. I'd be very wary of trying to change the real
type of a value except between ones that are bitwise compatible (like I
think varchar and text are technically, but I'm not sure).

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-12-07 02:09:59 Re: [SQL] how to change the type
Previous Message Christopher Kings-Lynne 2001-12-07 01:45:35 Re: how to chane the type

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-12-07 02:09:59 Re: [SQL] how to change the type
Previous Message Christopher Kings-Lynne 2001-12-07 01:45:35 Re: how to chane the type