Re: Creating a column interger with default to not null

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Chris Barnes <compuguruchrisbarnes(at)hotmail(dot)com>
Subject: Re: Creating a column interger with default to not null
Date: 2010-09-24 15:11:55
Message-ID: 201009240811.55324.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 24 September 2010 8:05:43 am Chris Barnes wrote:
> I am confused with what this is telling me.
> I have a table and I am trying to add a new column with constraint not
> null.
>
>
> What am I missing?
> Chris
>
>
> pgdb001=> alter table schema.table add COLUMN column_name integer not null;
> ERROR: column "column_name" contains null values

The error message :) The column has NULLs in it so you can not make it NOT NULL
until you get rid of them.

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2010-09-24 15:56:37 Re: Trade Study on Oracle vs. PostgreSQL
Previous Message Craig Ringer 2010-09-24 15:11:39 Re: Restore/dump from "/usr/local/pgsql/data" directory