Re: [HACKERS] alter table - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] alter table
Date
Msg-id 24681.931295575@sss.pgh.pa.us
Whole thread Raw
In response to alter table  (Vince Vielhaber <vev@michvhf.com>)
Responses Re: [HACKERS] alter table
List pgsql-hackers
Vince Vielhaber <vev@michvhf.com> writes:
> Can a serial type be added to an existing table using ALTER TABLE?  If so
> why doesn't it work on hub?  If not, I guess that explains why it doesn't
> work, so I'm open to suggestions on how to add it easily...

I'm not sure about this, but I seem to recall that ALTER TABLE ADD
COLUMN doesn't know anything about adding constraints or defaults.
And, of course, the default clause for a serial column is what *really*
makes it go.  Given this lack, the fact that ALTER TABLE is also
unprepared to create the underlying sequence object for a SERIAL column
is the least of your worries ;-)

There was some discussion a few months ago about redesigning the support
for SERIAL columns to make them less of an add-on kluge and more of a
real integrated feature.  I'd be inclined to think that that should
happen before we try to teach ALTER TABLE about serial columns ---
otherwise it'll just be another kluge in need of replacement.  Does
anyone recall what happened with that discussion thread?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Leon
Date:
Subject: Re[2]: [HACKERS] Fwd: Joins and links
Next
From: Vince Vielhaber
Date:
Subject: Re: [HACKERS] alter table