Re: diary constraints

From: Gnanavel S <s(dot)gnanavel(at)gmail(dot)com>
To: Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: diary constraints
Date: 2005-08-23 09:00:10
Message-ID: eec3b03c0508230200127dd262@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 8/23/05, Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk> wrote:
>
> Hi folks
>
> I know this has been discussed in the past, but no amount of keywords
> has returned anything from the archives.
>
> I want to create a courtesy car diary diary system where I have a table
> containing all of the cortesy cars in the pool, and then an allocation
> table which has two timestamps, one for the start date/time and one for
> the return date/time.
>
> How do I go about creating constraints on inserts and updates to ensure
> that
>
> a) the finish is after the start

check constraint like -> "finish_time > start_time" this will do

b) two allocations for a single vehicle don't overlap.

Use "overlaps" function in a trigger to validate the above.

--
> Gary Stainburn
>
> This email does not contain private or confidential material as it
> may be snooped on by interested government parties for unknown
> and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
with regards,
S.Gnanavel
Satyam Computer Services Ltd.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message PFC 2005-08-23 09:06:42 Re: diary constraints
Previous Message Michael Glaesemann 2005-08-23 08:58:13 Re: diary constraints