Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds the operators of the multirange types, as
multirangetypes.chas them. Each operator takes a multirange on one side and a multirange, a range or a value on the other side.Changes
multirange_union(+),multirange_minus(-) andmultirange_intersect(*). The difference and the intersection go through the two multiranges in one pass, asmultirange_minus_internalandmultirange_intersect_internaldo.multirange_minus_multi, which gives no row for an empty difference.&&,@>and<@with a multirange or a range on each side, and@>and<@with a value. Each side is a list of ranges in order, so one pass finds the answer.<<,>>,&<,&>and-|-. These compare only the lower bound of the first range and the upper bound of the last range, so{[1,5),[7,8)} -|- {[5,7)}is false, as in PostgreSQL.range_split_internalin the range module gives the two parts of a range that another range cuts.Tests
multirange_opsis the output of PostgreSQL 19 for the same script in a new database. It has each operator with empty, infinite and discrete multiranges, the errors of the types that do not match, a cross join of multiranges and a query with parameters.