Re: [SQL] how to change the type - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: [SQL] how to change the type
Date
Msg-id GNELIHDDFBOCMGBFGEFOAELBCAAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: [SQL] how to change the type  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> char(N) does store the trailing spaces, so altering N would give
> unwanted results: again, existing values would read out with the old
> width until updated.  You could fix this by issuing
>
>     UPDATE tab SET col = col
>
> after tweaking the pg_attribute.atttypmod value.  (AFAICS, any "clean"
> implementation would have to do just that internally, with the same
> unpleasant space and speed implications as we've discussed for DROP
> COLUMN.)

Can I take this opportunity to give my little thought on operations like
these (alter column type, drop column, etc.?)

If the DBA had to issue these commands every 5 minutes, then the speed and
space implications would be bad, yeah.  However, if all I want to do is drop
a column once every 6 months, then I don't really care that the operation
might take a minute and might consume lots of disk space...


Chris



pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: text -> time cast problem
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: pg_dump: Sorted output, referential integrity