From: | Heikki Linnakangas <heikki(at)enterprisedb(dot)com> |
---|---|
To: | Jens Schicke <j(dot)schicke(at)asco(dot)de> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #3542: Dropped and recreated columns have problems with NOT NULL contraints |
Date: | 2007-08-16 11:41:23 |
Message-ID: | 46C437E3.8050506@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
What did you expect?
Jens Schicke wrote:
> pizza_de=# alter table store_flags add column flag integer;
> ALTER TABLE
> pizza_de=# alter table store_flags drop column flag;
> ALTER TABLE
> pizza_de=# alter table store_flags add column flag integer not null;
> ERROR: column "flag" contains null values
The column was not added. It would've been filled with NULLs, which
would violate the NOT NULL constraint. You have to give a DEFAULT if you
add a column with a NOT NULL constraint.
> pizza_de=# alter table store_flags drop column flag;
> ERROR: column "flag" of relation "store_flags" does not exist
The column doesn't exist, because the add column above failed, and was
rolled back.
> pizza_de=# alter table store_flags add column flag integer not null;
> ERROR: column "flag" contains null values
Same as above..
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Decibel! | 2007-08-16 14:09:11 | Re: BUG #3543: ARRAY(SELECT ...) contruct yields NULL without rows |
Previous Message | Jens Schicke | 2007-08-16 11:11:49 | BUG #3543: ARRAY(SELECT ...) contruct yields NULL without rows |