In article <20110413163120.gu24...@shinkuro.com>,
Andrew Sullivan writes:
> On Wed, Apr 13, 2011 at 09:21:20AM -0700, 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'".
> ALTER TA
On Wed, Apr 13, 2011 at 09:21:20AM -0700, 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'".
ALTER TABLE table ALTER [ COLUMN ] column SET DEFAULT expression
(see http://www.postgres
"Gauthier, Dave" writes:
> Is there a way to add a default value definition to an existing column?
> Something like an "alter table... alter column... default 'foo'".
ALTER TABLE ... ALTER COLUMN ... SET DEFAULT ...
regards, tom lane
--
Sent via pgsql-general mailing
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;
Is there a way to add a default value definition to an existing column?
Something like an "alter table... alter column... default 'foo'".
I thought of a clumsy way to do this... create a temp column, set it's value to
that of the column to be altered, drop the column to be altered, redefine it