huaxingao commented on code in PR #13925:
URL: https://github.com/apache/iceberg/pull/13925#discussion_r2308845938


##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java:
##########
@@ -137,8 +138,12 @@ public void doCommit(TableMetadata base, TableMetadata 
metadata) {
     } catch (SQLWarning e) {
       throw new UncheckedSQLException(e, "Database warning");
     } catch (SQLException e) {
-      // SQLite doesn't set SQLState or throw 
SQLIntegrityConstraintViolationException
-      if (e.getMessage() != null && e.getMessage().contains("constraint 
failed")) {
+      // SQLite/Postgres doesn't set SQLState or throw 
SQLIntegrityConstraintViolationException

Review Comment:
   PostgreSQL sets SQLSTATE 23505 for unique_violation. Can we check 
e.getSQLState() instead of matching the error message? It's brittle to match 
error message because it's driver/version/locale dependent



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to