Add missing inequality searches to rbtree
authorAlexander Korotkov <akorotkov@postgresql.org>
Fri, 8 Jul 2022 18:51:26 +0000 (21:51 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Fri, 8 Jul 2022 19:00:03 +0000 (22:00 +0300)
commite57519a4637a8d88ae993ac1273d2b59d03a0f75
treead7cd9f1f6022ff118b9c6c970ee9be615c31526
parent8d51d7f403c209ab4d5db203f5e350f6c71233ca
Add missing inequality searches to rbtree

PostgreSQL contains the implementation of the red-black tree.  The red-black
tree is the ordered data structure, and one of its advantages is the ability
to do inequality searches.  This commit adds rbt_find_less() and
rbt_find_great() functions implementing these searches.  While these searches
aren't yet used in the core code, they might be useful for extensions.

Discussion: https://postgr.es/m/CAGRrpzYE8-7GCoaPjOiL9T_HY605MRax-2jgTtLq236uksZ1Sw%40mail.gmail.com
Author: Steve Chavez, Alexander Korotkov
Reviewed-by: Alexander Korotkov
src/backend/lib/rbtree.c
src/include/lib/rbtree.h
src/test/modules/test_rbtree/test_rbtree.c