Re: [HACKERS] ALTER TABLE ADD COLUMN

From: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>
To: pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] ALTER TABLE ADD COLUMN
Date: 1999-06-02 00:50:11
Message-ID: 37547FC3.40106A5E@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:

> Our TODO now has:
>
> * ALTER TABLE ADD COLUMN to inherited table put column in wrong place
>
> I don't think any of us understand the issues on this one.

Let me guess at the problem. When you add a column, it doesn't change
all the records, therefore the column must be added at the end. This
means that the columns will not be in the same order as if you had
created them from scratch.

There seem to be three solutions:
a) Go to a much more sophisticated schema system, with versions and
version numbers (fairly hard but desirable to fix other schema change
problems). Then insert the column in the position it is supposed to be
in.

b) Fix the copy command to input and output the columns, not in the
order they are in, but in the order they would be in on re-creation.

c) make the copy command take arguments specifying the field names, like
INSERT can do.

I think it would be good if Postgres had all 3 features. Probably (b) is
the least work.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 1999-06-02 01:24:57 RE: [HACKERS] Open 6.5 items
Previous Message Zalman Stern 1999-06-01 23:34:59 Re: [HACKERS] Re: [SQL] Column name's length