Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? - Mailing list pgsql-hackers

From Sam Mason
Subject Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?
Date
Msg-id 20090522093431.GB5407@samason.me.uk
Whole thread Raw
In response to Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, May 21, 2009 at 12:26:08PM -0400, Tom Lane wrote:
> I'd envision it
> as an extra column in pg_attribute, and it would work for any column(s).
> There's nothing to be gained by restricting it.

Yes, when I said "first" I meant the only thing that needs to be stored
is the first default value for the column.  The code currently assumes
that this first default value is NULL and is hence able to optimize the
case where you adding a NULLable column.  Adding this first default
value to pg_attribute would allow you to break this assumption and
allow the user to have non-NULL default values without complete table
rewrites.

I think the discussion covered this, but I don't think I was
particularly clear in my first message and thought I should attempt to
explain what I was saying.  Other comments about only allowing STABLE
expressions and non-toastable values make sense and were the sorts of
things I thought I would miss.

--  Sam  http://samason.me.uk/


pgsql-hackers by date:

Previous
From: Gevik Babakhani
Date:
Subject: A humble request
Next
From: David Fetter
Date:
Subject: Re: A humble request