Re: changing constraints

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: David <de4(at)kent(dot)ac(dot)uk>
Cc: "pgsql-sql (at) postgresql (dot) org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: changing constraints
Date: 2004-03-10 13:07:49
Message-ID: 20040310130749.A14958@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 |
+------------------------------+---------------------------------------------+

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2004-03-10 13:41:20 Re: changing constraints
Previous Message David 2004-03-10 12:27:05 changing constraints