yzeng1618 commented on code in PR #10048:
URL: https://github.com/apache/seatunnel/pull/10048#discussion_r2521773885
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresJdbcRowConverter.java:
##########
@@ -316,4 +362,110 @@ public String microsecondsToIntervalFormatVal(String
intervalVal) {
if (seconds > 0) sb.append(seconds).append(" seconds");
return sb.toString().trim();
}
+
+ private OffsetDateTime getPostgresOffsetDateTime(ResultSet rs, int
columnIndex)
+ throws SQLException {
+ // Read the value ONCE to avoid drivers returning null on subsequent
reads
+ final Object obj;
+ try {
+ obj = rs.getObject(columnIndex);
+ } catch (SQLException e) {
+ log.debug("Failed to get object from ResultSet at column {}",
columnIndex, e);
+ // Best-effort fallback to string, still only a single read path
for parsing
+ try {
+ final String str = rs.getString(columnIndex);
+ if (str != null && !str.trim().isEmpty()) {
+ return parsePostgresTimestampTz(str);
+ }
+ } catch (SQLException se) {
+ log.debug("Failed to get string from ResultSet at column {}",
columnIndex, se);
+ }
+ return null;
Review Comment:
All timestamptz parsing goes through a single normalized path—ISO parse
first, then UTC fallback. Only when both fail do we throw an SQLException with
the original string, so unsupported formats no longer get silently written as
null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]