On Sat, 20 Sep 2003 18:55:34 -0400, Kevin Houle <[EMAIL PROTECTED]>
wrote:
>     SELECT INTO result * FROM table_rates WHERE
>       effective_date >= NEW.effective_date AND
>       expiry_date <= NEW.expiry_date AND
>       cost = NEW.cost;
>     IF FOUND THEN
>        RAISE EXCEPTION ''record overlaps with existing record'';
>     END IF;

This only catches complete inclusion of an old range in the new one.
    new        b---------------------e
    old             b--------------e

Try
 WHERE effective_date < NEW.expiry_date
   AND expiry_date > NEW.effective_date

which also detects
    new        b--------------------e
    old             b-------------------e
    old   b------------------e
    old  b--------------------------------e

Servus
 Manfred

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to