Skip to content

fix(timezone): add UTC fast path in str_to_offset to fix error 1298 on Windows#881

Open
ep-12221 wants to merge 1 commit into
masterfrom
fix/2026042200115621510-timezone-utc-1298
Open

fix(timezone): add UTC fast path in str_to_offset to fix error 1298 on Windows#881
ep-12221 wants to merge 1 commit into
masterfrom
fix/2026042200115621510-timezone-utc-1298

Conversation

@ep-12221

Copy link
Copy Markdown
Contributor

Task Description

Fix the issue where executing SET @@session.time_zone='UTC' on Windows returns ER_UNKNOWN_TIME_ZONE (1298) when the timezone system table data is not loaded or is incomplete.

Solution Description

The root cause is that str_to_offset correctly identifies 'UTC' as a non-offset format and returns OB_ERR_UNKNOWN_TIME_ZONE. Subsequently, find_pos_time_zone attempts to look up 'UTC' as a timezone name, which fails because the timezone system data is not loaded.

The fix adds a fast path for 'UTC' within the str_to_offset function, treating 'UTC' as an offset of 0 (equivalent to '+00:00'). UTC is a fixed timezone without DST transitions, so its offset is always 0. This fast path does not depend on the timezone system table data.

Passed Regressions

Upgrade Compatibility

Other Information

DIMA: 2026042200115621510

Release Note

…n Windows

Root cause: On Windows, when the timezone system table data is not loaded or is incomplete, executing `SET @@session.time_zone='UTC'` would result in ER_UNKNOWN_TIME_ZONE (1298). This is because `str_to_offset` correctly identifies 'UTC' as a non-offset format and returns OB_ERR_UNKNOWN_TIME_ZONE. Subsequently, `find_pos_time_zone` attempts to look up 'UTC' as a timezone name, which fails due to the unloaded timezone system data.

Fix: Added a fast path for 'UTC' in `str_to_offset`, treating 'UTC' as offset=0 (equivalent to '+00:00'). UTC is a fixed timezone without DST transitions, with an offset always of 0. This fast path does not rely on the timezone system table data.

Scope of impact: Only affects timezone offset string parsing; does not affect other timezone name lookup logic.
DIMA: 2026042200115621510
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.

1 participant