Re: ALTER TABLE & NOT NULL

From: Joe Conway <mail(at)joeconway(dot)com>
To: "Thomas T(dot) Thai" <tom(at)minnesota(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: ALTER TABLE & NOT NULL
Date: 2002-04-06 19:28:59
Message-ID: 3CAF4C7B.1050202@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas T. Thai wrote:
> How do you alter a column so that it uses NOT NULL? I tried:
>
> alter table auth_users alter email set default not null;
>
> ERROR: Column "email" is of type character varying but default expression
> is of type boolean
> You will need to rewrite or cast the expression
>

I think you have to add a table constraint to do that. Something like:

ALTER TABLE auth_users ADD CONSTRAINT auth_users_email CHECK (email is
not null);

Joe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas T. Thai 2002-04-06 20:43:23 Re: ALTER TABLE & NOT NULL
Previous Message Thomas T. Thai 2002-04-06 19:08:36 ALTER TABLE & NOT NULL