X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CEED8EFFDB for ; Thu, 5 Jun 2003 07:25:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 29839-06 for ; Thu, 5 Jun 2003 07:25:23 +0000 (GMT) Received: from shield.nordlb.lv (shield.pirmabanka.lv [195.114.57.4]) by svr1.postgresql.org (Postfix) with ESMTP id 5373CEFFB8 for ; Thu, 5 Jun 2003 07:25:21 +0000 (GMT) Received: from wall2.pirmabanka.lv (wall2-pub.nordlb.lv [195.114.57.14]) by shield.nordlb.lv (8.12.9/8.12.9) with SMTP id h557PJGZ014407 for ; Thu, 5 Jun 2003 10:25:19 +0300 Received: from share.nordlb.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Thu, 05 Jun 2003 10:25:19 +0300 (EET DST) Received: from pc311x1.nordlb.lv (localhost.localdomain [127.0.0.1]) by nordlb.lv (8.11.6/8.11.6) with SMTP id h557PGh01146 for ; Thu, 5 Jun 2003 10:25:18 +0300 Received: (qmail 30639 invoked by uid 100); 5 Jun 2003 07:28:05 -0000 Date: Thu, 5 Jun 2003 10:28:05 +0300 From: "Victor Yegorov" To: Martins Zarins Cc: pgsql-admin@postgresql.org Subject: Re: ALTER TABLE Message-ID: <20030605072805.GN23596@nordlb.lv> Mail-Followup-To: Martins Zarins , pgsql-admin@postgresql.org References: <200306041805.10202.mark@vestnesis.lv> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200306041805.10202.mark@vestnesis.lv> User-Agent: Mutt/1.4.1i X-Archive-Number: 200306/18 X-Sequence-Number: 9009 * Martins Zarins [05.06.2003 10:18]: > Hello! > Can someone explain me, why last ALTER fails? > > work=# \d rdu > Table "rdu" > Column | Type | Modifiers > -------------+-----------------------------+------------------------------------------------ > id | integer | not null default > nextval('"rdu_id_seq"'::text) > numurs | integer | > versija | integer | > klients_id | integer | > pasutitajs | text | > agents_id | integer | > pasut_nr | integer | > status_id | character varying(1) | default 'S' > start_time | timestamp without time zone | not null default now() > end_time | timestamp without time zone | > finish_time | timestamp without time zone | > apraksts | text | > Indexes: rdu_agents_id, > rdu_klients_id > Unique keys: rdu_id_key > Triggers: RI_ConstraintTrigger_1187649, > RI_ConstraintTrigger_1187655, > RI_ConstraintTrigger_1187673, > RI_ConstraintTrigger_1187675 > > work=# ALTER TABLE rdu ADD CONSTRAINT rdu_end_time CHECK ((start_time <= > end_time) OR end_time IS NULL); > ALTER > work=# ALTER TABLE rdu ADD CONSTRAINT rdu_finish_time CHECK ((start_time <= > finish_time) OR finish_time IS NULL); > ERROR: AlterTableAddConstraint: rejected due to CHECK constraint > rdu_finish_time Perhaps you have some rows, for which check fails, i.e. (start_time > finish_time AND finish_time IS NOT NULL) is true. -- Victor Yegorov