Re: set default: question - Mailing list pgsql-novice

From Tom Lane
Subject Re: set default: question
Date
Msg-id 22181.1271974615@sss.pgh.pa.us
Whole thread Raw
In response to set default: question  (Marco Bomben <marco.bomben@gmail.com>)
List pgsql-novice
Marco Bomben <marco.bomben@gmail.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

pgsql-novice by date:

Previous
From: jr
Date:
Subject: Re: PostgreSQL Book
Next
From: Tim Bunce
Date:
Subject: Re: PLPerl not installed correctly?