Search Postgresql Archives

Re: challenging constraint situation - how do I make it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Harald Armin Massa wrote:
I have a business rule which gives me rahter big challenges to "melt in SQL":

But it is not really fitting; and manual editing of the table can
disturb it. So, ist there some constraint creatable to make sure that
"in each point of time" each id only exists once?

You probably need to write a constraint trigger, using OVERLAPS and EXISTS operators. Writing one is rather trivial, but depends on your exact business rules.

From your example it is not clear to me if you can have, for example, two records with different id's within the same or overlapping timespans.

When encountering this problem I usually wonder why there isn't a data type that can store a timestamp and can be used to create a UNIQUE INDEX over it's values. That'd be wonderful.
Well, maybe one day I'll actually have time to create one...

--
Alban Hertroys
alban@xxxxxxxxxxxxxxxxx

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux