Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: BUG #4125: Strange ALTER TABLE behavior



"Vladimir Kanazir" <vladimir(at)vlajko(dot)com> writes:
> If I execute this query:
> alter table history add incoming_id bigint default 0;

> the table will be locked until operation finishes (checked by executing the
> select query on the same table via another connection).

Indeed, because it has to physically fill the value zero into every
table row.

> But, if I do this:
> alter table history add incoming_id bigint;
> alter table history alter incoming_id set default 0;
> update history set incoming_id=0;
> the table will be locked only during alter table execution, which is very
> short time.

But this exposes the state where incoming_id isn't zero to other
transactions.

			regards, tom lane



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group