Re: [HACKERS] ADD COLUMN - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] ADD COLUMN
Date
Msg-id 199905150855.EAA11252@candle.pha.pa.us
Whole thread Raw
In response to ADD COLUMN  (Chris Bitmead <chris.bitmead@bigfoot.com>)
List 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,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] System Catalogs
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] CVS