zhangshenghang commented on code in PR #10048:
URL: https://github.com/apache/seatunnel/pull/10048#discussion_r2538268618
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresJdbcRowConverter.java:
##########
@@ -316,4 +366,134 @@ 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
+ final String str;
+ try {
+ str = rs.getString(columnIndex);
+ } catch (SQLException se) {
+ log.debug("Failed to get string from ResultSet at column {}",
columnIndex, se);
+ return null;
+ }
+ return parseTimestampIfPresent(str);
+ }
Review Comment:
Under what circumstances does getObject throw an SQLException, while
getString does not?
--
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]