Adding a NOT NULL column? - Mailing list pgsql-general

From Philip Molter
Subject Adding a NOT NULL column?
Date
Msg-id 20010626113759.D12723@datafoundry.net
Whole thread Raw
List pgsql-general
So I can add a column like:

  ALTER TABLE t ADD c SMALLINT

and I can then set it's default value like:

  ALTER TABLE t ALTER c SET DEFAULT 0

but how do set that new column to be NOT NULL?  The postgres docs say
do something like:

  ALTER TABLE t ADD (table constraint definition)

so I would do that like:

  ALTER TABLE ADD c NOT NULL
  ALTER TABLE ADD CONSTRAINT c NOT NULL

each time it fails on the 'NOT'.  How do I add that constraint?

* Philip Molter
* DataFoundry.net
* http://www.datafoundry.net/
* philip@datafoundry.net

pgsql-general by date:

Previous
From: Tony Grant
Date:
Subject: Re: More Red Hat information
Next
From: Bruce Momjian
Date:
Subject: Re: More Red Hat information