From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Michael Richards" <miker(at)interchange(dot)ca> |
Cc: | "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>, "Hannu Krosing" <hannu(at)tm(dot)ee>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Tuple data |
Date: | 2000-12-18 01:58:21 |
Message-ID: | 9918.977104701@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Michael Richards" <miker(at)interchange(dot)ca> writes:
> What are the cases where the current implementation does not handle it
> properly?
Inheritance.
CREATE TABLE parent (a, b, c);
CREATE TABLE child (z) INHERITS (parent);
ALTER TABLE parent ADD COLUMN (d);
With the current implementation you now have column order a,b,c,d in the
parent, and a,b,c,z,d in the child. This is seriously broken for a
number of reasons, not least being that pg_dump can't realistically be
expected to reproduce that state.
I don't really buy the complaint about "it'll take 2x the space". So
what? You'll likely expend that anyway trying to load reasonable data
into the new column. If we implemented ADD COLUMN in a less klugy
fashion, we could at least support loading a DEFAULT value into the
column (not to mention allowing it to be NOT NULL). More to the point,
I don't think that using 2x space is a sufficient justification for the
complexity and fragility that are imposed *throughout* the system in
order to make ADD COLUMN's life easy. You pay those hidden costs every
day you use Postgres, even if you've never done an ADD COLUMN in your
life.
> You could define a flag or something so a deleted column could be so flagged
> and ALTER TABLE DELETE COLUMN would run just as fast.
Hiroshi already tried that; you can find the vestiges of his attempt in
current sources (look for _DROP_COLUMN_HACK__). Again, the cost to the
rest of the system strikes me as far more than I care to pay.
In the end it's a judgment call --- my judgment is that making these
features fast is not worth the implementation effort and
understandability/reliability penalties that ensue. I think we would
be better off spending our effort on other things.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Bierman | 2000-12-18 02:11:09 | Re: [HACKERS] 7.1 features list |
Previous Message | The Hermit Hacker | 2000-12-18 01:43:15 | Re: [HACKERS] 7.1 features list |