Skip to content

[MySQL] Decode zero DATETIME(n) text values as null - #1771

Merged
tsegismont merged 2 commits into
eclipse-vertx:masterfrom
sharanggupta:mysql-zero-datetime-fraction
Nov 13, 2026
Merged

tsegismont merged 2 commits into
eclipse-vertx:masterfrom
sharanggupta:mysql-zero-datetime-fraction

Conversation

@sharanggupta

Copy link
Copy Markdown
Contributor

A simple query reading a zero DATETIME(n) or TIMESTAMP(n) value fails to parse 0000-00-00 00:00:00.000000, logs a DateTimeParseException and returns the result without that row. The text decoder now treats any zero datetime as null, like the binary protocol and the zero DATETIME without fractional seconds. The test runs against MySQL with an empty sql_mode so that the server returns the zero value.

A simple query reading a zero DATETIME or TIMESTAMP with fractional
seconds failed to parse '0000-00-00 00:00:00.000000' and dropped the
row. The binary protocol already returns null for it.

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
Assisted-by: Anthropic Claude (claude-opus-5-5)
@vietj vietj added this to the 5.3.0 milestone Oct 29, 2026
@tsegismont tsegismont changed the title Decode zero DATETIME(n) text values as null [MySQL] Decode zero DATETIME(n) text values as null Nov 12, 2026

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @sharanggupta

Declare the decoded text as a String in both zero-date checks, so no
conversion call is needed.

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
Assisted-by: Anthropic Claude (claude-fable-5-2)

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks @sharanggupta

@tsegismont
tsegismont merged commit af6936f into eclipse-vertx:master Nov 13, 2026
20 checks passed
tsegismont added a commit that referenced this pull request Nov 13, 2026
* Decode zero DATETIME(n) text values as null

A simple query reading a zero DATETIME or TIMESTAMP with fractional
seconds failed to parse '0000-00-00 00:00:00.000000' and dropped the
row. The binary protocol already returns null for it.


Assisted-by: Anthropic Claude (claude-opus-5-5)

* Compare zero dates as strings

Declare the decoded text as a String in both zero-date checks, so no
conversion call is needed.


Assisted-by: Anthropic Claude (claude-fable-5-2)

---------


(cherry picked from commit af6936f)

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Co-authored-by: Sharang Gupta <sharang@sharanggupta.dev>
tsegismont added a commit that referenced this pull request Nov 13, 2026
* Decode zero DATETIME(n) text values as null

A simple query reading a zero DATETIME or TIMESTAMP with fractional
seconds failed to parse '0000-00-00 00:00:00.000000' and dropped the
row. The binary protocol already returns null for it.


Assisted-by: Anthropic Claude (claude-opus-5-5)

* Compare zero dates as strings

Declare the decoded text as a String in both zero-date checks, so no
conversion call is needed.


Assisted-by: Anthropic Claude (claude-fable-5-2)

---------


(cherry picked from commit af6936f)

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Co-authored-by: Sharang Gupta <sharang@sharanggupta.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants