Re: Adding a default value to a column after it exists - Mailing list pgsql-general

From Mike Fowler
Subject Re: Adding a default value to a column after it exists
Date
Msg-id 4DA5CE61.9000808@mlfowler.com
Whole thread Raw
In response to Adding a default value to a column after it exists  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List pgsql-general
Hi Dave,

On 13/04/11 17:21, Gauthier, Dave wrote:
>
> Is there a way to add a default value definition to an existing
> column?  Something like an "alter table... alter column... default 'foo'".
>

Sure is something like that:

ALTER TABLE tablename ALTER COLUMN columnname SET DEFAULT expression;

For full documentation see:
http://www.postgresql.org/docs/9.0/static/sql-altertable.html

> Thanks for any help.
>

Regards,

--
Mike Fowler
Registered Linux user: 379787


pgsql-general by date:

Previous
From: "Gauthier, Dave"
Date:
Subject: Adding a default value to a column after it exists
Next
From: Tom Lane
Date:
Subject: Re: Adding a default value to a column after it exists