Alter table Add Primary Key - Mailing list pgsql-general

From Ana Claudia
Subject Alter table Add Primary Key
Date
Msg-id 25CCC6566D01D411885B00A024559FB7011FE072@EXCHANGE_GERAL
Whole thread Raw
List pgsql-general
Hello,

I'd like to know if is possible create a primary key in a table that already
exits in database (note: in Oracle is possible), because I try do that and I
received an ERROR MESSAGES

Example:
/*Script taht I used to create the table*/
CREATE TABLE tespri
(
pri NUMERIC(3,0) NOT NULL  CHECK (pri between 0 and 255),
sec   VARCHAR(4) NOT NULL CHECK (sec<> 'ana')
);


/* End of Script   */



teste=# \d tespri
               Table "tespri"
 Attribute |         Type         | Modifier
-----------+----------------------+----------
 pri       | numeric(3,0)         | not null
 sec       | character varying(4) | not null
Constraints: ((pri >= '0'::"numeric") AND (pri <= '255'::"numeric"))
             (sec <> 'ana'::"varchar")

teste=# alter table tespri add constraint ck1 PRIMARY KEY(pri);
ERROR:  ALTER TABLE / ADD CONSTRAINT is not implemented for that constraint
type.
teste=#

/* NOTE: database name teste        table name tespri  */

Thanks for everything.
Best Regards,
Cláudia



Ana Cláudia Dias
Aveiro - Portugal

Email: ana-b-dias@ptinovacao.pt

pgsql-general by date:

Previous
From: Ian.Willis@csiro.au
Date:
Subject: Re: My brain hurts - update field based on value of ano
Next
From: Keary Suska
Date:
Subject: Re: query multiple databases