fix: MySQL compatibility for JDBC plugin temporal writes - #132
Open
xudamao2015 wants to merge 2 commits into
Open
fix: MySQL compatibility for JDBC plugin temporal writes#132xudamao2015 wants to merge 2 commits into
xudamao2015 wants to merge 2 commits into
Conversation
- InstantTypeHandler: write java.time.Instant as JDBC Timestamp instead of
Instant.toString() (ISO-8601 with 'Z' + nanosecond precision). MySQL DATETIME
rejects the ISO string with 'Incorrect datetime value'; SQLite TEXT and
PostgreSQL TIMESTAMPTZ tolerated it. setTimestamp is portable across drivers.
- MemoryAdminService.listMemories: the COUNT query wraps a derived table
without an alias; MySQL requires every derived table to have an alias
('Every derived table must have its own alias'). Add 'memory_count' alias.
The JDBC plugin (memind-plugin-jdbc-core) writes java.time.Instant as ISO-8601 strings (Instant.toString()) via Jdbi and graph operations. MySQL DATETIME(3) rejects those strings with 'Incorrect datetime value'; only SQLite TEXT and PostgreSQL TIMESTAMPTZ tolerated them. - JdbiTemporalSupport: bind Instant as JDBC Timestamp; parseInstant now also accepts the 'yyyy-MM-dd HH:mm:ss[.SSS]' space-separated format. - JdbcGraphOperations: dialect-aware setTemporal() (setString for SQLite, setTimestamp for MySQL/PostgreSQL) used by entity/mention/link/alias/ cooccurrence writes; the varargs binder passes Instant directly instead of a pre-formatted string. SQLite behavior is unchanged (still stores ISO-8601 text).
Collaborator
|
@xudamao2015 Thanks for the fix — the MySQL direction and the derived-table alias look right. However, I don’t think this is safe to merge yet:
spotless:check also currently fails in JdbcGraphOperations. Could we keep temporal handling dialect-aware and add round-trip tests for SQLite and non-UTC MySQL before merging? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix JDBC 插件时间字段写入与 admin memory 查询的 MySQL 兼容问题