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 === ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org