Thread: alter table question for 7.2
hi, can anyone tell me the right way to do something like alter table foo add column bar int not null default '0'; in a postgresql 7.2 database? all i managed to do was to add the column and alter it to have "default '0'". neither where the fields filled with "0" (like they are when i do this in postgresql 8.1) nor did i manage to add the "not null" constraint. thx for help matthias
Matthias Leopold <matthias@aic.at> wrote: > hi, > > can anyone tell me the right way to do something like > > alter table foo add column bar int not null default '0'; > > in a postgresql 7.2 database? Update now! IIRC, first add the column and then use ALTER TABLE SET DEFAULT. Try that, i'm not sure, 7.2 is too old. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
Andreas Kretschmer <akretschmer@spamfence.net> writes: > Matthias Leopold <matthias@aic.at> wrote: >> ... in a postgresql 7.2 database? > Update now! Seriously, you should *not* be using 7.2. It's been unsupported for more than four years. There are numerous known data-eating bugs in it, not to mention security holes. regards, tom lane