ADD CONSTRAINT NOT NULL, how? - Mailing list pgsql-novice

From Lutz Horn
Subject ADD CONSTRAINT NOT NULL, how?
Date
Msg-id 20020518102011.GA1420@lutz-horn.de
Whole thread Raw
Responses Re: ADD CONSTRAINT NOT NULL, how?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hi all,

I'm trying to add a column with "NOT NULL" to an existing table using
the ALTER TABLE command.

db=> ALTER TABLE t1 ADD COLUMN f2 integer NOT NULL;
ERROR:  Adding NOT NULL columns is not implemented.
        Add the column, then use ALTER TABLE ADD CONSTRAINT.

OK, this is not the way to do it. The solution seems to be to first add
the column without "NOT NULL" and use "ADD CONSTRAINT" later. My problem
ist: what ist the syntax for adding this constraint?

BTW, im running "PostgreSQL 7.2.1 on i686-pc-linux-gnu".

Regards
Lutz

pgsql-novice by date:

Previous
From: gerry.smit@lombard.ca
Date:
Subject: Re: Answering my own question
Next
From: bob parker
Date:
Subject: Re upgrading 7.1 to 7.2