Re: changing constraints - Mailing list pgsql-sql

From Achilleus Mantzios
Subject Re: changing constraints
Date
Msg-id Pine.LNX.4.44.0403101540070.2365-100000@matrix.gatewaynet.com
Whole thread Raw
In response to changing constraints  ("David" <de4@kent.ac.uk>)
List pgsql-sql
O kyrios David egrapse stis Mar 10, 2004 :

> I tried adding a constraint thus:
> de4=> ALTER TABLE genus ADD CHECK(gender = 'masculine' || 'feminine');
> But get the msg:
> ERROR:  AlterTableAddConstraint: rejected due to CHECK constraint $2

Which pgsql version are you using??

In any case what you wrote means CHECK (gender='masculinefeminine')
you should write it as gender = 'masculine' OR gender = 'feminine'.

> 
> de4=> \d genus
>                 Table "public.genus"
>      Column     |         Type          | Modifiers
> ----------------+-----------------------+-----------
>  genus_name     | character varying(20) | not null
>  gender         | character varying(10) |
>  cas_gen_number | integer               |
>  family_name    | character(7)          |
> Indexes: genus_pkey primary key btree (genus_name)
> Foreign Key constraints: $1 FOREIGN KEY (family_name) REFERENCES
> family(family_name) ON UPDATE NO ACTION ON DELETE NO ACTION
> 
> I cant see a $2 constraint so why am i getting the error msg?
> 
> Many thanks Dave
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
> 

-- 
-Achilleus



pgsql-sql by date:

Previous
From: Paul Thomas
Date:
Subject: Re: changing constraints
Next
From: Richard Huxton
Date:
Subject: Re: changing constraints