Re: feature request - adding columns with default value

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Diogo de Oliveira Biazus <diogo(at)ikono(dot)com(dot)br>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: feature request - adding columns with default value
Date: 2003-04-04 14:24:36
Message-ID: 20030404062236.L92769-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 4 Apr 2003, Diogo de Oliveira Biazus wrote:

> Henrik Steffen wrote:
>
> >hello,
> >
> >when doing an "alter table blub add column blah int2"
> >and then issuing an "alter table blub alter column blah set default 0"
> >I will always have to manually "update blub set blah=0" to initialize
> >all existing records.... this is quite annoying while performing this
> >update on a running database with 100 simultaneous clients accessing
> >the database and about 443482 rows in the table.
> >
> >it takes about 10 minutes to perform this update, and for about 6 minutes
> >all other updates to the table are in status "waiting", this leads to
> >a very high load and all max_connection setting is reached soon
> >(on a Dual-Xeon 2.4 GHz machine with 2 GB RAM)
> >
> >i would suggest to change the "alter table add column" function to
> >adding a default value while adding the column if this is possible
> >and if this minimizes "down-time".
> >
> >thank you
> >
> >
> Maybe I'm wrong, but this feature was supported in 7.1,
> and it was removed in 7.2.
> If what I'm saying is true, I would like to know why was this feature
> removed?

AFAIR, some older versions accepted the syntax but then totally ignored
the extra attributes (ie, you could say something like int2 default 0, but
the default was just silently lost).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lonni J Friedman 2003-04-04 14:35:00 Re: unable to dump database, toast errors
Previous Message Jason Hihn 2003-04-04 14:13:54 Re: Single Byte values