Re: Changing column types... - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Changing column types...
Date
Msg-id 24045.1018019305@sss.pgh.pa.us
Whole thread Raw
In response to Re: Changing column types...  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
>> Hmm.  Seems like that case, and the various ones involving adjustment of
>> char/varchar length by hacking atttypmod, would be useful to support via
>> ALTER COLUMN even if we don't have a full implementation.  Essentially
>> this would be taking the existing folklore about safe ways to hack
>> pg_attribute and reducing them to code --- why not do it?

> Can you only reduce the length of a varchar (say) or can you actually
> increase them as well?

You can go either way.  If you're reducing then in theory you should
scan the column and make sure that no current values exceed the new
limit.

For char() as opposed to varchar(), you actually need to update the
column to establish the correctly-padded new values.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Always the same ecpg bug - please (re)apply patch
Next
From: Jan Wieck
Date:
Subject: Re: timeout implementation issues