Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

unique index on variable time


  • From: "pgsql-general(at)list(dot)coretech(dot)ro" <pgsql-general(at)list(dot)coretech(dot)ro>
  • To: pgsql-general(at)postgresql(dot)org
  • Subject: unique index on variable time
  • Date: Sun, 16 Apr 2006 19:07:11 +0300
  • Message-id: <44426BAF(dot)4070703(at)list(dot)coretech(dot)ro>


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





Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group