Re: diary constraints

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: diary constraints
Дата
Msg-id 20050823091238.GD24431@webserv.wug-glas.de
обсуждение исходный текст
Ответ на diary constraints  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список 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    === 


В списке pgsql-sql по дате отправления:

Предыдущее
От: PFC
Дата:
Сообщение: Re: diary constraints
Следующее
От:
Дата:
Сообщение: Re: Problem calling stored procedure