Add red-black tree missing comparison searches

From: Steve Chavez <steve(at)supabase(dot)io>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Add red-black tree missing comparison searches
Date: 2022-06-30 16:51:22
Message-ID: CAGRrpzYE8-7GCoaPjOiL9T_HY605MRax-2jgTtLq236uksZ1Sw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

Currently the red-black tree implementation only has an equality search.
Other extensions might need other comparison searches, like less-or-equal
or greater-or-equal. For example OrioleDB defines a greater-or-equal search
on its postgres fork:

https://github.com/orioledb/postgres/blob/4c18ae94c20e3e95c374b9947f1ace7d1d6497a1/src/backend/lib/rbtree.c#L164-L186

So I thought this might be valuable to have in core. I've added
less-or-equal and greater-or-equal searches functions plus tests in
the test_rbtree module. I can add the remaining less/great searches if this
is deemed worth it.

Also I refactored the sentinel used in the rbtree.c to use C99 designators.

Thanks in advance for any feedback!

--
Steve Chavez
Engineering at https://supabase.com/

Attachment Content-Type Size
0001-Add-red-black-tree-missing-comparison-searches.patch text/x-patch 6.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-06-30 16:51:49 Re: PATCH: Add Table Access Method option to pgbench
Previous Message vignesh C 2022-06-30 16:10:14 Re: Handle infinite recursion in logical replication setup