Skip to content

Conversation

@otan
Copy link
Contributor

@otan otan commented May 20, 2020

We previously relied on golang's time.Time library to return 24:00 time
for us; however, time.Time does not parse 24:00 well, nor does it print
24:00 as on the same day (it uses the next day).

As such, when parsing or emitting time.Time, we have to be super weary
of how we output 24:00 time. Two major changes:

Resolves #44548.

Release note (sql change, bug fix): 24:00 time now displays correctly in
the cli, returning 0001-01-02 00:00:00. Furthermore, backups correctly
emit and read in 24:00 time properly.

@otan otan requested review from a team, pbardea and rohany and removed request for a team May 20, 2020 16:28
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rohany
Copy link
Contributor

rohany commented May 20, 2020

Whats the reason for adding a new function here that allows 24:00? Why can't we just update existing cases to handle it?

@otan
Copy link
Contributor Author

otan commented May 20, 2020

Because existing functions will overflow 24:00 to 00:00. This needs to be explicit and that's only from parsing and reading from disk.

Copy link
Contributor

@rohany rohany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, i would just make that more explicit then -- I can imagine a month or two from now I wouldn't remember which one to use where.

@pbardea pbardea removed their request for review May 21, 2020 13:47
We previously relied on golang's time.Time library to return 24:00 time
for us; however, time.Time does not parse 24:00 well, nor does it print
24:00 as on the same day (it uses the next day).

As such, when parsing or emitting time.Time, we have to be super weary
of how we output 24:00 time. Two major changes:
* update lib/pq to pick up lib/pq#944 such that
it can parse 24:00 time externally.
* update places where time.Time is parsed from a go driver or lib/pq to
correctly handle 24:00 cases.

Release note (sql change, bug fix): 24:00 time now displays correctly in
the cli, returning `0001-01-02 00:00:00`. Furthermore, backups correctly
emit and read in 24:00 time properly.
@otan
Copy link
Contributor Author

otan commented May 21, 2020

tftr!

bors r=rohany

@craig
Copy link
Contributor

craig bot commented May 21, 2020

Build failed (retrying...)

@craig
Copy link
Contributor

craig bot commented May 21, 2020

Build succeeded

@craig craig bot merged commit 148c315 into cockroachdb:master May 21, 2020
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.

lib/pq handling of 24:00:00 is broken

3 participants