Thread: Re: [PATCHES] ALTER TABLE modifications

Re: [PATCHES] ALTER TABLE modifications

From
Rod Taylor
Date:
-- moving to -hackers

> Do you have special cases for type changes which don't need data
> transforms. 

> I mean things like changing VARCHAR(10) to VARCHAR(20), dropping the NOT
> NULL constraint or changing CHECK A < 3 to CHECK A < 4. 

There are basically 3 types of change.

The first is simple, a removal. These do not kick off scans of any form.
You simply do not add any work to the post-processing queue.

The second requests a table scan. This is intended for check constraint,
etc. additions.

The third is a rewrite of the records which is done with via a file
swap. All type changes, column + default additions, etc. are done this
way. It will simultaneously take care of the check constraint, etc.
requests as well.

> All these could be done with no data migration or extra checking.

I'll leave it for someone else to add in the queue bypasses for simple
items. I've otherwise attempted to maintain the current processes (new
check constraint always scans, etc.).


Queued foreign keys are going to need to work a little differently since
they are cross table checks. I'm currently deferring them until
everything else has been accomplished (affects alter type only at the
moment).