Re: changing constraints - Mailing list pgsql-sql

From Paul Thomas
Subject Re: changing constraints
Date
Msg-id 20040310130749.A14958@bacon
Whole thread Raw
In response to changing constraints  ("David" <de4@kent.ac.uk>)
List pgsql-sql
On 10/03/2004 12:27 David wrote:
> 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
> 
> 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


Just guessing but maybe it's because gender is nullable?

-- 
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for 
Business             |
| Computer Consultants         | 
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+


pgsql-sql by date:

Previous
From: "David"
Date:
Subject: changing constraints
Next
From: Achilleus Mantzios
Date:
Subject: Re: changing constraints