Re: How to ALTER COLUMN to set a constraint of not null?

From: "Peter Gibbs" <peter(at)emkel(dot)co(dot)za>
To: "Jean-Christian Imbeault" <jc(at)mega-bucks(dot)co(dot)jp>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to ALTER COLUMN to set a constraint of not null?
Date: 2003-01-14 09:47:33
Message-ID: 024001c2bbb1$f653fca0$0b01010a@emkel.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jochem van Dieten 2003-01-14 09:58:21 Re: PostgreSQL on Windows
Previous Message Julian Scarfe 2003-01-14 09:46:16 Vacuum verbose output?