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

sql: fix current_timestamp behaviour with time zone set #43012

Merged
merged 1 commit into from
Dec 6, 2019

Conversation

otan
Copy link
Contributor

@otan otan commented Dec 5, 2019

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.

@otan otan requested review from solongordon and a team December 5, 2019 23:53
@cockroach-teamcity
Copy link
Member

This change is Reviewable

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 midngiht`, `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.
@otan
Copy link
Contributor Author

otan commented Dec 6, 2019

bors r+

craig bot pushed a commit that referenced this pull request Dec 6, 2019
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>
@craig
Copy link
Contributor

craig bot commented Dec 6, 2019

Build succeeded

@craig craig bot merged commit b78a228 into cockroachdb:master Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants