cannot add "not null" to an existing table

From: marco ghidinelli <marcogh(at)linux(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: cannot add "not null" to an existing table
Date: 2002-10-21 16:09:10
Message-ID: 20021021160909.GA8352@ufficio.chiocciolina.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hello,
i can't be able to add a constraint to a table.

example:

alter table mytable add primary key (id);

-- i get the error: Existing attribute "id" cannot be a PRIMARY KEY because
-- it is not marked NOT NULL
--
-- but at this point i cannot be able to add the constraint not null to the
-- column id.
--
-- i tried:
alter table mytable alter column id set not null;
-- ERROR: parser: parse error at or near "not"

alter table mytable set not null (id);
-- ERROR: parser: parse error at or near "set"

alter table mytable add not null (id);
-- ERROR: parser: parse error at or near "not"

----------------------------------------
note that i must alter an existing table, or copying and modifying an
existing table.

postgresql 7.2.3 - debian package.
postgresql 7.2.2 - debian package.

any idea?

--
BOFH excuse #321:

Scheduled global CPU outage

Browse pgsql-general by date

  From Date Subject
Next Message Ericson Smith 2002-10-21 16:11:35 Numerous postmaster processes after upgrading to 7.2.3
Previous Message Jeffrey Bohmer 2002-10-21 16:08:52 Re: Buffers and MacOS X