Re: RFC: Temporal Extensions for PostgreSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RFC: Temporal Extensions for PostgreSQL
Date: 2007-02-19 15:10:53
Message-ID: 9501.1171897853@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Dawid Kuroczko" <qnex42(at)gmail(dot)com> writes:
> ... Now, assuming UNIQUE INDEX on such table, the order would be preserved
> since no two intervals can overlap. And no overlapping data could be inserted
> without breaking "ovelapivity". And of course non-unique index would
> produce garbage (since left of/right of wouldn't make any sense anymore).

I think actually it doesn't work for unique indexes either :-( because
of dead tuples. Consider that we have in the index

...
(1,2)
(6,8) DEAD
(4,10)
(12,14)
...

Since under the given operators (6,8) and (4,10) are "equal", btree will
not guarantee that those index entries appear in any particular relative
order. Thus the above is a legal index configuration. Now insert (3,5).
This should surely be rejected because it overlaps (4,10). But what
may well happen is that it gets compared to (1,2) --- OK, it's greater
--- and to (6,8) --- OK, it's less --- and then the uniqueness check stops,
because if it's less than (6,8) then there is no need to search further.
Ooops.

*This* is why the transitive law is essential.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavan Deolasee 2007-02-19 15:14:54 Re: Chatter on DROP SOMETHING IF EXISTS
Previous Message Magnus Hagander 2007-02-19 15:07:12 Re: pg_restore fails with a custom backup file