| From: | Greg Stark <gsstark(at)mit(dot)edu> |
|---|---|
| To: | Jeff Davis <pgsql(at)j-davis(dot)com> |
| Cc: | David Fetter <david(at)fetter(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: WIP: generalized index constraints |
| Date: | 2009-07-06 16:02:27 |
| Message-ID: | 407d949e0907060902q5f88e087k73a88d611837edbe@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Jul 6, 2009 at 4:57 PM, Jeff Davis<pgsql(at)j-davis(dot)com> wrote:
>
> Exactly, you already know my use case ;) My goal is a "temporal key",
> where you can't have overlapping intervals of time, e.g. the constraint
> "nobody can be two places at the same time".
Incidentally to handle non-overlapping ranges you don't need GIST, you
can actually use a plain btree. Since there are no overlapping ranges
the ranges have a complete ordering and you can get that by just
sorting by either endpoint. To enforce the constraint you only have to
compare with the previous and following element in the btree.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jaime Casanova | 2009-07-06 16:10:28 | TODO items: Alter view add column |
| Previous Message | Jeff Davis | 2009-07-06 15:57:52 | Re: WIP: generalized index constraints |