diff options
| author | Alexander Korotkov | 2022-07-08 18:51:26 +0000 |
|---|---|---|
| committer | Alexander Korotkov | 2022-07-08 19:00:03 +0000 |
| commit | e57519a4637a8d88ae993ac1273d2b59d03a0f75 (patch) | |
| tree | ad7cd9f1f6022ff118b9c6c970ee9be615c31526 /src/include | |
| parent | 8d51d7f403c209ab4d5db203f5e350f6c71233ca (diff) | |
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
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/lib/rbtree.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/lib/rbtree.h b/src/include/lib/rbtree.h index 580a3e3439..13cf68415e 100644 --- a/src/include/lib/rbtree.h +++ b/src/include/lib/rbtree.h @@ -67,6 +67,8 @@ extern RBTree *rbt_create(Size node_size, void *arg); extern RBTNode *rbt_find(RBTree *rbt, const RBTNode *data); +extern RBTNode *rbt_find_great(RBTree *rbt, const RBTNode *data, bool equal_match); +extern RBTNode *rbt_find_less(RBTree *rbt, const RBTNode *data, bool equal_match); extern RBTNode *rbt_leftmost(RBTree *rbt); extern RBTNode *rbt_insert(RBTree *rbt, const RBTNode *data, bool *isNew); |
