[pkg-db-devel] Bug#783147: Bug#783147: db5.3-dev: The library implementation improperly contrains the BTREE comparison function.

Florian Weimer fw at deneb.enyo.de
Tue May 5 20:52:10 UTC 2015


* Lee Ward:

> In my application, the database is keyed by interval, i.e. an <offset, extent>
> pair. In such a database two keys will compare "equal" if two intervals
> intersect, lesser if they do not intersect and the first interval
> lies below the second, or greater if they do not intersect and the first lies
> above. Thus, the constraint that the BTREE comparison function "must cause the
> keys in the database to be well-ordered" is met.

Well-ordering requires anti-symmetry, that is compare(A, B) <= 0 and
compare(B, A) <= 0 should imply A = B.  Your example violates that if
A and B intersect because compare(A, B) and compare(B, A) are both
zero, yet you want to treat A and B as distinct.



More information about the pkg-db-devel mailing list