Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?
Date: 2009-05-22 09:34:31
Message-ID: 20090522093431.GB5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuhito Kasahara 2009-05-22 11:59:44 patch for ja.po
Previous Message Gevik Babakhani 2009-05-22 08:39:13 A humble request