Re: Cannot add non-null columns

From: Miha Radej <miha(dot)radej(at)siix(dot)com>
To: teknokrat <teknokrat(at)yahoo(dot)com>
Cc: pgadmin-support(at)postgresql(dot)org
Subject: Re: Cannot add non-null columns
Date: 2004-10-05 13:04:37
Message-ID: 41629BE5.2080009@siix.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

hi!

afaik you cannot add a not null column to a table because (in a table
where there is already some data) the field values are null. the option
to add a not null column perhaps only works on an empty table with no
rows yet. so this behaviour is expected.
therefore you need to add a column, update the table to set the column
values so there is no null fields and then you can alter the column to
set it a default value, then again to set it no null. this always worked
for me.

hope it helps.

regards,
Miha

teknokrat wrote:
> If I go to a tables properties and try adding a non-null column I get an
> error. Adding the from the column view is OK.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Dave Page 2004-10-05 14:10:29 Re: Multiple selections delete bug
Previous Message teknokrat 2004-10-05 12:05:28 Cannot add non-null columns