-
Notifications
You must be signed in to change notification settings - Fork 503
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PostgreSql TSRANGE/TSTZRANGE support #5297
Draft
griffio
wants to merge
26
commits into
cashapp:master
Choose a base branch
from
griffio:add-postgresql-ts-range
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
extract temporal fields
todo - bindarg test "?" needs cast e.g `?::TIMESTAMP`
Add Support for: SELECT EXTRACT(MONTH FROM DATE '2023-05-15'); SELECT EXTRACT(HOUR FROM TIME '10:30:45');
SELECT EXTRACT(MONTH FROM DATE '2023-05-15'); SELECT EXTRACT(HOUR FROM TIME '10:30:45');
To support Extract
Literal Date and Time tests
Integration Test for Extract
Add error to validate temporal types
Integration test for INTERVAL returns double(3)
Add latest temporal fields (22)
Add range functions
new range type
For range index use
integration test for functions
@> and <@ are shared by tsvector and json types Range specific operators '&&' '<<' '>>' '&>' '&<' '-|-'
TSRANGE, TSTZRANGE boolean operator
Fixture test Integration test
used to create ranges e.g tsrange('2010-01-01 14:30:00', '2010-01-01 15:30:00', '[]')
TSMULTIRANGE, TSTZMULTIRANGE Add range_agg function - this is useful to have for multirange queries
A more complex query showing use of multiranges
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.
馃懛 馃毀 Add some support for TS Range type https://www.postgresql.org/docs/16/rangetypes.html#RANGETYPES-EXAMPLES
Types are mapped to string representations as there is no client side data type such as a range that is compatible (Kotlin ranges only implement open/closed on upper bounds). This is consistent with JSON, TSVECTOR types and uses OTHER type to bind the literal value.
Range functions https://www.postgresql.org/docs/16/functions-range.html are used to work with ranges e.g extract lower and upper values to the client types
LocalDateTime
andOffSetDateTime
Also add basic support for
EXCLUDE
table constraints for range supported indexesMultiRange support (Postgresql 14 or higher)
Allows useful arithmetic on ranges
e.g identify the available time slots that are not occupied by any appointments within a specified time range.
Note: 馃 Merge this after #5274
TODO:
Create issue for PR
More tests e.g cast
SELECT '("2010-01-01 14:30:00+00","2010-01-01 15:30:00+00"]'::TSTZRANGE