Re: Adding columns in the middle of tables

From: Jaime Casanova <systemguards(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Adding columns in the middle of tables
Date: 2004-09-06 07:52:48
Message-ID: 20040906075248.10519.qmail@web50006.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

--- Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> escribió:
> We looked at this and decided that it would be
> vastly more trouble than
> it's worth --- not only in terms of effort to
> implement the feature
> originally, but in ongoing maintenance and risk of
> bug creation.
>
> For instance, the original proposals about it
> required separating
> "logical" and "physical" column numbers, so that a
> new column could be
> added physically at the end but logically be earlier
> in the sequence.
> This would be a huge amount of work to get done in
> the first place:
> you'd have to look at essentially every single use
> of column numbers
> in both the backend and every application and decide
> which flavor you
> wanted to use at that place. And mistakenly using
> the wrong flavor
> would be a permanent gotcha that could be expected
> to introduce new bugs
> in future.
>
> Given the 8.0 ALTER TABLE feature of being able to
> rewrite the whole
> table, one could now think about doing it without
> decoupling logical
> and physical numbers: just rewrite the table with
> the new column
> inserted in the proper place. This moves the
> problem to a different
> area, which is being sure you have updated every
> place in the system
> catalogs and backend caches that references the old
> column numbers of
> the renumbered columns. Again, doable in theory but
> a lot of work,
> and it introduces a bug hazard every time someone
> changes these data
> structures.
>
> So, no we're not likely to do it ourselves, and we'd
> probably reject as
> unmaintainable any patch to do it in either of the
> above ways. What's
> needed to get the idea off the "forget it" list is a
> different
> implementation plan that isn't going to create a
> maintenance headache.
>
> regards, tom lane

Got it.

Obviously this is not a necesary feature and is a
feature that good design can do a very rare need.
I will think if there is another implementation plan
that can be used (but if *the core* didn't find it i
hardly will).

thanx a lot for the explanation,

Jaime Casanova

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2004-09-06 08:24:34 Re: huge execution time difference with almost same plan
Previous Message Reini Urban 2004-09-06 07:14:58 Re: APR 1.0 released