-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
builtins: add CURRENT_TIME functionality #42928
Conversation
ee1df74
to
29a5eaf
Compare
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 seems like the TIMETZ version differs from Postgres in that it does not reflect the session time zone. Is that right? For example set time zone -5; select current_time::text;
returns different results between CRDB and Postgres.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @solongordon)
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.
Reviewable status: complete! 0 of 0 LGTMs obtained
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.
trying to figure out why current_timestamp is okay though...
Reviewable status: complete! 0 of 0 LGTMs obtained
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.
hint: it is not -- #43012
Reviewable status: complete! 0 of 0 LGTMs obtained
This PR adds CURRENT_TIME as a builtin. Release note (sql change): This PR adds the CURRENT_TIME builtin, which can be used with precision, e.g. `SELECT CURRENT_TIME, CURRENT_TIME(3)`.
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.
Reviewed 9 of 9 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained
bors r+ |
42928: builtins: add CURRENT_TIME functionality r=otan a=otan Resolves #31708 Refs #26097 This PR adds CURRENT_TIME as a builtin. Release note (sql change): This PR adds the CURRENT_TIME builtin, which can be used with precision, e.g. `SELECT CURRENT_TIME, CURRENT_TIME(3)`. 43012: sql: fix current_timestamp behaviour with time zone set r=otan a=otan With time zones set, current_timestamp needs to localise to the timezone set in the context for time options, e.g. for `TIME` with `UTC+3` at `UTC midnight`, `current_timestamp()` should return `3am`. This was previously not handled correctly by Timestamp, and is rectified in this PR. Release note (bug fix): Previously, current_timestamp would not correctly account for `SET TIME ZONE` in the background when storing results, storing the timestamp as `UTC` instead. This is fixed in this PR. Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
Build succeeded |
Resolves #31708
Refs #26097
This PR adds CURRENT_TIME as a builtin.
Release note (sql change): This PR adds the CURRENT_TIME builtin, which
can be used with precision, e.g.
SELECT CURRENT_TIME, CURRENT_TIME(3)
.