Re: How to ALTER COLUMN to set a constraint of not null? - Mailing list pgsql-general

From Peter Gibbs
Subject Re: How to ALTER COLUMN to set a constraint of not null?
Date
Msg-id 024001c2bbb1$f653fca0$0b01010a@emkel.co.za
Whole thread Raw
In response to How to ALTER COLUMN to set a constraint of not null?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Responses Re: How to ALTER COLUMN to set a constraint of not null?
List pgsql-general
Jean-Christian Imbeault wrote:

> How does one add a "NOT NULL" constraint to a new column?

> JC=# alter table credit_card_names alter column number_length set
> default not null;
> ERROR:  Column "number_length" is of type smallint but default

ALTER TABLE [ ONLY ] table [ * ]
    ALTER [ COLUMN ] column { SET | DROP } NOT NULL

i.e.  alter table credit_card_names alter column number_length set not null;

--
Peter Gibbs
EmKel Systems


pgsql-general by date:

Previous
From: "Julian Scarfe"
Date:
Subject: Vacuum verbose output?
Next
From: Jochem van Dieten
Date:
Subject: Re: PostgreSQL on Windows