fix(oracle): decode TIMESTAMP, INTERVAL, and BFILE through typed paths (#965)#966
fix(oracle): decode TIMESTAMP, INTERVAL, and BFILE through typed paths (#965)#966
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5381593bbb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let formatter = DateFormatter() | ||
| formatter.locale = Locale(identifier: "en_US_POSIX") | ||
| formatter.timeZone = TimeZone(secondsFromGMT: 0) | ||
| formatter.dateFormat = "yyyy-MM-dd" |
There was a problem hiding this comment.
Preserve time when rendering Oracle DATE values
Oracle DATE stores hours/minutes/seconds, but this formatter hard-codes yyyy-MM-dd in UTC, so any non-midnight DATE value loses its time component and can even show the wrong calendar day after UTC conversion. This is a data-accuracy regression for common schemas that use DATE as a full datetime, because users will see truncated/misaligned values rather than what is stored.
Useful? React with 👍 / 👎.
| @Test("TIMESTAMP local style renders an offset matching the host's current zone") | ||
| func timestampLocal() { | ||
| let result = OracleCellFormatting.formatTimestamp(Self.referenceDate, style: .local) | ||
| #expect(!result.hasSuffix("Z")) |
There was a problem hiding this comment.
Accept
Z output for UTC in timestamp offset tests
These assertions assume local/zoned formatting never ends with Z, but ISO8601DateFormatter emits Z for zero-offset time zones (e.g., UTC), so the test fails on UTC hosts. That makes the suite environment-dependent and can break CI or contributor runs where TimeZone.current is Etc/UTC.
Useful? React with 👍 / 👎.
Summary
Closes #965. Oracle TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE, INTERVAL DAY TO SECOND, INTERVAL YEAR TO MONTH, DATE, RAW, and BLOB columns now decode through typed paths instead of reading binary bytes as UTF-8 (the source of the unreadable text in #965). Tables containing INTERVAL YEAR TO MONTH or BFILE columns previously crashed the app on row fetch via OracleNIO's
fatalError/preconditionFailurefor unsupported wire-protocol types — both crash sites now throw recoverable errors and the plugin renders unknown types as<unsupported: typename>placeholders without losing the rest of the row.OracleConnection.decodeCellrewritten as aswitch cell.dataTypeover OracleNIO's typed decoders. Foundation-onlyOracleCellFormattingextracted for testability without linking OracleNIO into the test target.0 00:00:01.5,5 03:14:00), preserving up to 9-digit nanosecond precision when present; INTERVAL YEAR TO MONTH renders asY-MM; RAW/BLOB hex-encoded with 4 KB cap.TableProApp/oracle-nio@f343a0d(tablepro-mainbranch) which adds anIntervalYMdecoder, a BFILE locator-passthrough case, and replaces the twofatalError/preconditionFailuresites with thrownOraclePartialDecodingError. Upstream PR to follow.Test plan
--strictpasses on all changed filesswift build; row/message-decoder unit tests (9 cases) passgvenzl/oracle-free:23-slim) usingtimestamp_reprofixture table: all four TIMESTAMP variants, both INTERVAL variants, DATE, and a 38-digit-precision NUMBER render correctly; BFILE shows<bfile>placeholder; query does not crashxcodebuild -only-testing:TableProTests/Oracle\ cell\ formatting(run on your end)<unsupported: …>should appear without crashing