Re: [HACKERS] ADD COLUMN

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>
Cc: pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] ADD COLUMN
Date: 1999-05-15 08:55:50
Message-ID: 199905150855.EAA11252@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

  • ADD COLUMN at 1999-05-14 12:34:15 from Chris Bitmead

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-05-15 08:59:37 Re: [HACKERS] configure --with-xxxx problem
Previous Message Bruce Momjian 1999-05-15 08:54:08 Re: [HACKERS] System Catalogs