Re: [HACKERS] ADD COLUMN

Bruce Momjian <maillist@candle.pha.pa.us>

From: Bruce Momjian <maillist@candle.pha.pa.us>
To: Chris Bitmead <chris.bitmead@bigfoot.com>
Cc: pgsql-hackers@hub.org
Date: 1999-05-15T08:55:50Z
Lists: pgsql-hackers
> 
> Can somebody explain briefly what happens when you do an ALTER TABLE ADD
> COLUMN? Obviously it doesn't seem to go through the database and update
> every record with a new attribute there and then. Does it get updated
> the next time the record is retrieved or what is the story there?

NULL fields take up no space in rows, so adding NULL to the end of a row
really doesn't change the row, you just tell the catalog the column
exists, and the system sees a NULL there by default.

On updates, it remains the same unless you put something in the column.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026