Re: [PATCHES] ALTER TABLE modifications

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] ALTER TABLE modifications
Date: 2003-11-16 14:37:13
Message-ID: 1068993432.87852.9.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-11-16 14:50:11 Re: start of transaction (was: Re: [PERFORM] Help with count(*))
Previous Message Hannu Krosing 2003-11-16 14:10:00 Re: ALTER TABLE modifications

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-11-16 16:21:58 Re: SIGPIPE handling
Previous Message Hannu Krosing 2003-11-16 14:10:00 Re: ALTER TABLE modifications