On Thu, Jun 08, 2006 at 12:19:49PM -0400, Greg Stark wrote:
>
> "Jim C. Nasby" <jnasby@pervasive.com> writes:
>
> > On Thu, Jun 08, 2006 at 11:42:49AM -0400, Greg Stark wrote:
> > > But I seem to recall some headaches with that approach.
> >
> > What happens if you
> >
> > ALTER TABLE ... ADD new_column int DEFAULT 1;
> > ALTER TABLE ... ALTER new_column SET DEFAULT 2;
>
> Ah yes. Keeping track of multiple old defaults and when they were in effect
> would indeed be quite a headache.
Probably. One possibility would be to track the table definition on an
XID basis and compare that info to the XMIN of a given row; that would
allow you to know exactly what the state of the table columns was. But
there's still a lot of pitfalls with that, such as VACUUM FREEZE. Since
ALTER TABLE on a very large table can be such a nightmare maybe some day
this will happen, but I'm not holding my breath.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461