Add PostgreSQL like Range/Multirange Functions
- Dominant language
- Go
- Stars
- 14.3k
- Forks
- 1.1k
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 11
Description
**Is your feature request related to a problem? Please describe.**
`pgx` defines a `Range[T]` type that can be used to store PostgreSQL ranges. I use the ranges in a `CopyFrom` call, but sometimes the call contains one or more overlapping ranges that are not allowed in my table definition. Therefore, the whole `CopyFrom` fails. It would be helpful if I could use the functions/operators as defined in https://www.postgresql.org/docs/current/functions-range.html to check the records I have before insert. I could imagine that for other use cases other functions/operators are helpful if they can be applied already in Go.
**Describe the solution you'd like**
I would like to add these functions in a file `range_functions.go` and `range_functions_test.go` in the `pgtype` package. Would you include these in `pgx` (pull request) or is it better to make a separate project for these functions?
**Describe alternatives you've considered**
A separate project that uses `pgtype.Range[T]`.
Contributor guide
Research direction
Read the PostgreSQL range and multirange functions documentation linked in the issue, then inspect pgtype.Range[T] and define which functions and operators are in scope. The proposed files are range_functions.go and range_functions_test.go in the pgtype package; done means the agreed API is implemented with tests covering the selected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100