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

overhaul our Postgres Range support #1050

Merged
merged 8 commits into from
Feb 22, 2023
Merged

overhaul our Postgres Range support #1050

merged 8 commits into from
Feb 22, 2023

Commits on Feb 20, 2023

  1. overhaul our Postgres Range support

    - We now go ahead and deconstruct the range value in the `FromDatum` implementation.  Immediately, this fixes issues with `pg_sys::RangeBound.val` datums potentially being able to be used after free.
    
    - `RangeData` is gone and replaced with a more idiomatic `RangeBound` enum, to which the internal Postgres `pg_sys::RangeBound` struct can be mapped.
    
    - We provide `From<std::ops::Range*>` impls for all of Rust's built-in Range types.
    
    - Our `pgx::Range` can be constructed from any type that can be converted into a `RangeBound` and we provide direct impls for the set of supported `RangeSubType` types along with `Option<T: RangeSubType>` which maps `Some` to `::Inclusive` and `None` to `::Infinite`.
    
    - The idea that a Postgres range can be "empty" is properly relayed through `Range`'s public API
    
    - add an example (albeit puny)
    eeeebbbbrrrr committed Feb 20, 2023
    Configuration menu
    Copy the full SHA
    5d33f22 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a23389c View commit details
    Browse the repository at this point in the history
  3. fix merge conflict

    eeeebbbbrrrr committed Feb 20, 2023
    Configuration menu
    Copy the full SHA
    1689bcf View commit details
    Browse the repository at this point in the history
  4. fix docs

    eeeebbbbrrrr committed Feb 20, 2023
    Configuration menu
    Copy the full SHA
    84f42f8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d55c26e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    61c27fc View commit details
    Browse the repository at this point in the history
  7. resolving conflicts

    eeeebbbbrrrr committed Feb 20, 2023
    Configuration menu
    Copy the full SHA
    9922454 View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2023

  1. - code review cleanup

    - add a few help methods to `RangeBound`
    - `impl Display for Range<T> where T: Display`
    eeeebbbbrrrr committed Feb 21, 2023
    Configuration menu
    Copy the full SHA
    c04bd8c View commit details
    Browse the repository at this point in the history