Re: SQL CONSTRAINTS - Constraining time values from two

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: SQL CONSTRAINTS - Constraining time values from two
Дата
Msg-id Pine.LNX.4.30.0110052143030.654-100000@peter.localdomain
обсуждение исходный текст
Ответ на SQL CONSTRAINTS - Constraining time values from two attributes on a table.  ("Maher, Christopher W" <christopher.w.maher@intel.com>)
Список pgsql-sql
Maher, Christopher W writes:

> I was looking for a solution on how to write a constraint into a ' create
> table ' expression that would ensure that one ' TIME ' attribute value
> called arrival_time (declared as TIME) is allways constrained to have a
> value that ensures it is allways after another attribute value called
> departure_time (declared as TIME).

create table test (   arrival_time time,   departure_time time,   check (arrival_time < departure_time)
);

insert into test values ('12:00', '14:30');
INSERT 20651 1

insert into test values ('12:00', '9:45');
ERROR:  ExecAppend: rejected due to CHECK constraint $1

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



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

Предыдущее
От: Alex Pilosov
Дата:
Сообщение: Re: temporary views
Следующее
От: Oleg Lebedev
Дата:
Сообщение: Quotes and spaces