apache/iceberg · warning · UncheckedSQLException

Database warning

Error message

Database warning

What it means

Thrown by JdbcViewOperations.doCommit when the driver raises a SQLWarning during a view commit. Wrapped in UncheckedSQLException. SQLWarning is rarely fatal; surfacing it as an exception means the driver reported a warning condition the code treats as a failed commit (driver-specific behavior).

Solutions

  1. Inspect the wrapped SQLWarning cause for the driver-specific message
  2. Check driver version compatibility with your database and update the JDBC driver
  3. Look for driver settings that escalate warnings to exceptions and adjust them
  4. Retry the commit if the warning was spurious and the database state is unchanged

Example fix

// before
// driver X throws SQLWarning on schema drift
// after
// upgrade driver and pin compatible version in build
// e.g. postgresql 42.7.x for PostgreSQL 15+
Defensive patterns

Strategy: try-catch

Try / catch

try {
  view.updateSchema(apply);
} catch (UncheckedSQLException e) {
  if (e.getCause() instanceof SQLWarning) {
    LOG.warn("SQL warning during commit: {}", e.getCause().getMessage());
  } else throw e;
}

Prevention

When it happens

Trigger: Committing a view while the driver emits a SQLWarning (e.g. implicit conversion, feature deprecation warnings escalated to exceptions by some drivers, or session-level warnings during DDL/DML).

Common situations: Unusual JDBC drivers or strict driver configurations that convert warnings into thrown SQLWarning subclasses; database version mismatches producing escalation warnings.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/d9bc3767ddf83699. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java:121

        validateMetadataLocation(view, base);
        String oldMetadataLocation = base.metadataFileLocation();
        // Start atomic update
        LOG.debug("Committing existing view: {}", viewName());
        updateView(newMetadataLocation, oldMetadataLocation);
      } else {
        // view does not exist, create it
        LOG.debug("Committing new view: {}", viewName());
        createView(newMetadataLocation);
      }

    } catch (SQLTimeoutException e) {
      throw new UncheckedSQLException(e, "Database Connection timeout");
    } catch (SQLTransientConnectionException | SQLNonTransientConnectionException e) {
      throw new UncheckedSQLException(e, "Database Connection failed");
    } catch (DataTruncation e) {
      throw new UncheckedSQLException(e, "Database data truncation error");
    } catch (SQLWarning e) {
      throw new UncheckedSQLException(e, "Database warning");
    } catch (SQLException e) {
      if (JdbcUtil.isConstraintViolation(e)) {
        if (currentMetadataLocation() == null) {
          throw new AlreadyExistsException(e, "View already exists: %s", viewIdentifier);
        } else {
          throw new UncheckedSQLException(e, "View already exists: %s", viewIdentifier);
        }
      }

      throw new UncheckedSQLException(e, "Unknown failure");
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new UncheckedInterruptedException(e, "Interrupted during commit");
    }
  }

  @Override
  protected String viewName() {

View on GitHub (pinned to 86d9c8fc54)