Re: set default: question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marco Bomben <marco(dot)bomben(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: set default: question
Date: 2010-04-22 22:16:55
Message-ID: 22181.1271974615@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Marco Bomben <marco(dot)bomben(at)gmail(dot)com> writes:
> I've a problem in understanding the "SET DEFAULT" command.
> fssr2db=# ALTER TABLE fssr2calibs ALTER COLUMN intvbn SET DEFAULT 139;
> ...
> So I do see the effects of SET DEFAULT on the table as a whole (through \d
> <table name>)
> but not on each row (I set the value for some of them and for some not
> before using SET DEFAULT).

SET DEFAULT only establishes a default to use in future INSERT
operations; it doesn't affect any existing rows. Perhaps you want
to do something like

UPDATE fssr2calibs SET intvbn = 139 WHERE intvbn IS NULL

in addition to setting the default?

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tim Bunce 2010-04-23 10:31:12 Re: PLPerl not installed correctly?
Previous Message Daniel Hutchison 2010-04-22 16:00:24 Re: PLPerl not installed correctly?