pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@myrealbox.com>
To: Gary Stainburn <gary.stainburn@ringways.co.uk>
Cc: postgresql sql list <pgsql-sql@postgresql.org>
Subject: Re: diary constraints
Date: Tue, 23 Aug 2005 17:58:13 +0900
Message-ID: <55E1EB3D-E2CF-41FD-86AD-B39007A48BF9@myrealbox.com> (raw)
In-Reply-To: <200508230933.59043.gary.stainburn@ringways.co.uk>
References: <200508230933.59043.gary.stainburn@ringways.co.uk>


On Aug 23, 2005, at 5:33 PM, Gary Stainburn wrote:

> 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
> b) two allocations for a single vehicle don't overlap.

This is an interesting problem. You might want to take a look at this  
book, previously mentioned on the one of the lists (by George Essig,  
I believe):

> Developing Time-Oriented Database Applications in SQL
> by Richard T. Snodgrass
>
> The book is out of print, but the author has made the PDF available  
> on his website at:
> http://www.cs.arizona.edu/people/rts/tdbbook.pdf

Hope this helps!

Michael Glaesemann
grzm myrealbox com





view thread (6+ messages)  latest in thread

Message-ID: <55E1EB3D-E2CF-41FD-86AD-B39007A48BF9@myrealbox.com>
Permalink:  ../55E1EB3D-E2CF-41FD-86AD-B39007A48BF9@myrealbox.com/
Also on:    postgresql.org/message-id/55E1EB3D-E2CF-41FD-86AD-B39007A48BF9@myrealbox.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: grzm@myrealbox.com, gary.stainburn@ringways.co.uk
  Subject: Re: diary constraints
  In-Reply-To: <55E1EB3D-E2CF-41FD-86AD-B39007A48BF9@myrealbox.com>

* 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