-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
mathesar-424 Handle TIMESTAMP
data type in the backend
#865
Conversation
Add support for timestamp with timezone and timestamp without timezone data type Add casting function for `timestamp without timezone` to cast from text containing a date time string without timezone to `timestamp without timezone` data type Update the date type casting function to not accept data that contains additional time information as it will be handled by timestamp data type Change the spelling from `TIMESTAMP_WITH_TIMESTAMP_ZONE` to `TIMESTAMP_WITH_TIME_ZONE` in `db/types/base.py`
…turns the same null value when casting it to different type, messing up with the type checking logic. Revert test cases that were accidentally deleted with previous commit
…amp with timezone and timestamp without timezone
ISCHEMA_NAME: PostgresType.TIMESTAMP_WITHOUT_TIME_ZONE.value, | ||
REFLECTED_NAME: TIMESTAMP_WITHOUT_TIME_ZONE, | ||
TARGET_DICT: { | ||
CHAR: {VALID: []}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume a timestamp should be castable to any text/character type, including CHAR
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to cast a timestamp
to CHAR
, but CHAR
returns exact number of characters specified and this causes problems with testing as the type_options that specifies length
has to be specified with each test case, which is not possible right now. I have created a issue that should help with testing such cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave this to @mathemancer to review/merge. I took a quick glance and don't see any issues.
Updated status to blocked since it's blocked by #628 |
# Conflicts: # db/types/datetime.py
Yes, I did notice it, sorry for not changing the status. I got caught up with other issues, will be working on it today. |
… that midnight timestamp string won't affect the cast Add date to timestamp casting function Add timestamp without timezone to timestamp with timezone casting functiong
I didn't want to modify the Moreover, I am not sure if this special case where performance drops applies in our situation as it mostly applies to table functions but wanted to give it the benefit of doubt |
…tion to remove unnecessary null checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should work, and the choices w.r.t. what casts to what else seem logical.
About setting the functions to RETURNS NULL ON NULL INPUT
, that should be safe since these are all casting functions that definitely ought to return null on null input. Also, many of them can't be inlined for various reasons. I'll make a separate issue to explore that, though, since some of them can be inlined, and these casting functions get run for every row of some table or another quite often. For now, it's a moot point, since the null checks all got removed (unless we do see some improvement overall in performance).
@mathemancer Thanks! I will change the strict keyword to |
@kgodey We need to specify that the |
…ULL INPUT` as it is descriptive
@silentninja Please document it in the code and in the wiki (write a short spec that's linked to from "Technical Specs" in https://wiki.mathesar.org/en/engineering/architecture). Please also explain what "can affect timezones" means in greater detail. |
@silentninja Feel free to merge this PR when you're ready. |
…n to cast a data type to timestamp without timezone
Fixes #424 Handle
Timestamp
data type in the backend.This PR introduces Timestamp data type(with and without timezone) and relevant functions to convert text data types that contain a date-time string into a
timestamp
data type.The order by which the data type is inferred will change to the following
date
type will be inferred.timezone
informationtimestamp without timezone
data type will be inferred.timestamp with timezone
data type will be introduced. This type will be inferred if only one or more rows contains the necessary information as other data type will end up with losing the informationTechnical details
Adds TImestamp with timezone and Timestamp without timezone data type and Relevant casting function that restricts the data that can be converted to the data type.
The casting function of
date
data type has been limited to accept onlytext
withdate
element that does not containtime
informationScreenshots
Checklist
Update index.md
).master
branch of the repositoryvisible errors.
TaskList
Developer Certificate of Origin
Developer Certificate of Origin