Skip to content

timeutil: allow certain timezone names to be case insensitive#57250

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
otan-cockroach:case_insensitive_time
Dec 2, 2020
Merged

timeutil: allow certain timezone names to be case insensitive#57250
craig[bot] merged 1 commit intocockroachdb:masterfrom
otan-cockroach:case_insensitive_time

Conversation

@otan
Copy link
Copy Markdown
Contributor

@otan otan commented Nov 30, 2020

Resolves #36847

Release note (sql change): Previously, timezones must be entered in the
same case as it is stored on the system. Now, timezone names can be case
insensitive provided it matches well known zone names according to Go's
time/tzdata package.

@otan otan requested a review from knz November 30, 2020 20:52
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@otan otan force-pushed the case_insensitive_time branch 2 times, most recently from 7ca6b66 to a5f669c Compare November 30, 2020 22:29
Copy link
Copy Markdown
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

I'm glad for the added fnctionality, but I think you can be more clever on the implementation.

The key observation is that you only needs the names, not the actual tzdata. So why don't you simply make a generator program that lists the contents of zoneinfo.zip and creates a go map (lowercase -> normal case) based on that? This could even be re-generated on every build, since we can assume that every Go toolchain will have zoneinfo.zip at a fixed location relative to $GOROOT.

Reviewed 7 of 7 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@otan otan force-pushed the case_insensitive_time branch from a5f669c to c4b583a Compare December 2, 2020 16:20
@otan
Copy link
Copy Markdown
Contributor Author

otan commented Dec 2, 2020

ah didn't realise it was in $GOROOT! fixed!

Copy link
Copy Markdown
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

Copy link
Copy Markdown
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

Wait you need to remove the entries that are just for directories, e.g. artic/

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

Release note (sql change): Previously, timezones must be entered in the
same case as it is stored on the system. Now, timezone names can be case
insensitive provided it matches well known zone names according to Go's
time/tzdata package.
@otan otan force-pushed the case_insensitive_time branch from c4b583a to 00f97bc Compare December 2, 2020 17:27
@otan
Copy link
Copy Markdown
Contributor Author

otan commented Dec 2, 2020

gotcha, done!

Copy link
Copy Markdown
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r3.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

Copy link
Copy Markdown
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@otan
Copy link
Copy Markdown
Contributor Author

otan commented Dec 2, 2020

cheers

bors r=knz

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 2, 2020

Build succeeded:

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.

sql: perform time zone name comparison case-insensitively

3 participants