Re: diary constraints

From: "A(dot) Kretschmer" <akretschmer(at)despammed(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: diary constraints
Date: 2005-08-23 09:12:38
Message-ID: 20050823091238.GD24431@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

am 23.08.2005, um 9:33:58 +0100 mailte Gary Stainburn folgendes:
> 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

with a check-constraint like this:
create table foobar (t1 timestamp, t2 timestamp check (t2>t1));

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

possibly with a trigger.

Regards, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message neil.saunders 2005-08-23 09:33:40 Re: Problem calling stored procedure
Previous Message PFC 2005-08-23 09:06:42 Re: diary constraints