Re: ALTER TABLE Column NOT NULL?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gregory Wood" <gregw(at)com-stock(dot)com>
Cc: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ALTER TABLE Column NOT NULL?
Date: 2002-01-25 19:52:35
Message-ID: 1073.1011988355@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Gregory Wood" <gregw(at)com-stock(dot)com> writes:
> Is there any way to add a NOT NULL constraint to a new field in a
> table,

After you fill the field with some non-nulls, you could add a CHECK NOT
NULL constraint, or if you prefer efficiency over cleanliness, tweak the
attnotnull field of the field's pg_attribute row.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2002-01-25 20:09:18 Re: ALTER TABLE Column NOT NULL?
Previous Message Gregory Wood 2002-01-25 19:39:28 ALTER TABLE Column NOT NULL?