pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Victor Yegorov <viktors.jegorovs@nordlb.lv>
To: Martins Zarins <mark@vestnesis.lv>
Cc: pgsql-admin@postgresql.org
Subject: Re: ALTER TABLE
Date: Thu, 5 Jun 2003 10:28:05 +0300
Message-ID: <20030605072805.GN23596@nordlb.lv> (raw)
In-Reply-To: <200306041805.10202.mark@vestnesis.lv>
References: <200306041805.10202.mark@vestnesis.lv>

* Martins Zarins <mark@vestnesis.lv> [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



view thread (5+ messages)

Message-ID: <20030605072805.GN23596@nordlb.lv>
Permalink:  ../20030605072805.GN23596@nordlb.lv/
Also on:    postgresql.org/message-id/20030605072805.GN23596@nordlb.lv

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: viktors.jegorovs@nordlb.lv, mark@vestnesis.lv
  Subject: Re: ALTER TABLE
  In-Reply-To: <20030605072805.GN23596@nordlb.lv>
  References: <200306041805.10202.mark@vestnesis.lv> <20030605072805.GN23596@nordlb.lv>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox