Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for currently unsupported Postgres multirange functions #4240

Open
21 of 40 tasks
guissalustiano opened this issue Sep 6, 2024 · 2 comments
Open
21 of 40 tasks
Assignees

Comments

@guissalustiano
Copy link
Contributor

guissalustiano commented Sep 6, 2024

Diesel is on path to supports the Postgres multirange type. This is a tracking issue for adding support for the type and it operators.

Type:

Operator list:

  • anymultirange @> anymultirange → boolean - Does the first multirange contain the second?
  • anymultirange @> anyrange → boolean - Does the multirange contain the range?
  • anymultirange @> anyelement → boolean - Does the multirange contain the element?
  • anyrange @> anymultirange → boolean - Does the range contain the multirange?
  • anymultirange <@ anymultirange → boolean - Is the first multirange contained by the second?
  • anymultirange <@ anyrange → boolean - Is the multirange contained by the range?
  • anyrange <@ anymultirange → boolean - Is the range contained by the multirange?
  • anyelement <@ anymultirange → boolean - Is the element contained by the multirange?
  • anymultirange && anymultirange → boolean - Do the multirange overlap, that is, have any elements in common?
  • anymultirange && anyrange → boolean - Does the multirange overlap the range?
  • anyrange && anymultirange → boolean - Does the range overlap the multirange?
  • anymultirange << anymultirange → boolean - Is the first multirange strictly left of the second?
  • anymultirange << anyrange → boolean - Is the multirange strictly left of the range?
  • anyrange << anymultirange → boolean - Is the range strictly left of the multirange?
  • anymultirange >> anymultirange → boolean - Is the first multirange strictly right of the second?
  • anymultirange >> anyrange → boolean - Is the multirange strictly right of the range?
  • anyrange >> anymultirange → boolean - Is the range strictly right of the multirange?
  • anymultirange &< anymultirange → boolean - Does the first multirange not extend to the right of the second?
  • anymultirange &< anyrange → boolean - Does the multirange not extend to the right of the range?
  • anyrange &< anymultirange → boolean - Does the range not extend to the right of the multirange?
  • anymultirange &> anymultirange → boolean - Does the first multirange not extend to the left of the second?
  • anymultirange &> anyrange → boolean - Does the multirange not extend to the left of the range?
  • anyrange &> anymultirange → boolean - Does the range not extend to the left of the multirange?
  • anymultirange -|- anymultirange → boolean - Are the multiranges adjacent?
  • anymultirange -|- anyrange → boolean - Is the multirange adjacent to the range?
  • anyrange -|- anymultirange → boolean - Computes the union of the multiranges. The multiranges need not overlap or be adjacent.
  • anymultirange * anymultirange → anymultirange - Computes the intersection of the multiranges.
  • anymultirange - anymultirange → anymultirange - Computes the difference of the multiranges.

Function list

  • lower ( anymultirange ) → anyelement - Extracts the lower bound of the multirange (NULL if the multirange is empty has no lower bound).
  • upper ( anymultirange ) → anyelement - Extracts the upper bound of the multirange (NULL if the multirange is empty or has no upper bound).
  • isempty ( anymultirange ) → boolean - Is the multirange empty?
  • lower_inc ( anymultirange ) → boolean - Is the multirange's lower bound inclusive?
  • upper_inc ( anymultirange ) → boolean - Is the multirange's upper bound inclusive?
  • lower_inf ( anymultirange ) → boolean - Does the multirange have no lower bound? (A lower bound of -Infinity returns false.)
  • upper_inf ( anymultirange ) → boolean - Does the multirange have no upper bound? (An upper bound of Infinity returns false.)
  • range_merge ( anymultirange ) → anyrange - Computes the smallest range that includes the entire multirange.
  • multirange ( anyrange ) → anymultirange - Returns a multirange containing just the given range.
  • unnest ( anymultirange ) → setof anyrange - Expands a multirange into a set of ranges. The ranges are read out in storage order (ascending).

Multiple functions and operators are the same of the range type, so we can use a helper type (e.g. MultirangeOrRangeMaybeNullable) and use the same function call (e.g. lower)

@wowinter13
Copy link
Member

wowinter13 commented Sep 7, 2024

We'll soon have a loooooot of work, I suppose 😄

@guissalustiano
Copy link
Contributor Author

guissalustiano commented Sep 13, 2024

I noticed that this would be easier than I thought, so I'm taking off the help wanted label and finishing it by myself.

@guissalustiano guissalustiano self-assigned this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants