unique index on variable time

Поиск
Список
Период
Сортировка
От pgsql-general@list.coretech.ro
Тема unique index on variable time
Дата
Msg-id 44426BAF.4070703@list.coretech.ro
обсуждение исходный текст
Ответы Re: unique index on variable time  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
hello,

I am interested to know if I can define an unique index on a timestamp
column to reject values within one hour.

insert into table(timestamp_col) values(LOCALTIMESTAMP);
insert into table(timestamp_col) values(LOCALTIMESTAMP + '5
minutes'::INTERVAL);
I want the second insert to fail with "unique violation".

is it possible to do something like that ? I am not interested in
"date_trunc" because I want it to work and for minute 59.

thanks,
Razvan Radu



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

Предыдущее
От: "pgsql-general@list.coretech.ro"
Дата:
Сообщение: inet value validation
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: unique index on variable time