prestodb/presto · error · SQLFeatureNotSupportedException

updateNCharacterStream

Error message

updateNCharacterStream

What it means

Presto's JDBC driver treats result sets as read-only and does not implement any of the JDBC updatable-result-set APIs; PrestoResultSet.updateNCharacterStream(int, Reader, long) therefore throws SQLFeatureNotSupportedException naming the method.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1426

    @Override
    public Reader getNCharacterStream(int columnIndex)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getNCharacterStream");
    }

    @Override
    public Reader getNCharacterStream(String columnLabel)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getNCharacterStream");
    }

    @Override
    public void updateNCharacterStream(int columnIndex, Reader x, long length)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateNCharacterStream");
    }

    @Override
    public void updateNCharacterStream(String columnLabel, Reader reader, long length)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateNCharacterStream");
    }

    @Override
    public void updateAsciiStream(int columnIndex, InputStream x, long length)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateAsciiStream");
    }

    @Override
    public void updateBinaryStream(int columnIndex, InputStream x, long length)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Execute an explicit SQL UPDATE via Statement/PreparedStatement instead of updating through the ResultSet
  2. Do not request CONCUR_UPDATABLE result sets from Presto; use READ_ONLY concurrency
  3. Move mutation logic to a layer that issues DML queries

Example fix

// before
rs.updateNCharacterStream("notes", reader, len);
// after
try (PreparedStatement ps = conn.prepareStatement("UPDATE t SET notes = ? WHERE id = ?")) {
    ps.setCharacterStream(1, reader, len);
    ps.setLong(2, id);
    ps.executeUpdate();
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (rs.getConcurrency() != ResultSet.CONCUR_READ_ONLY) { /* Presto only gives READ_ONLY; updates will fail */ }

Type guard

boolean supportsResultSetUpdates(ResultSet rs) {
    return !(rs instanceof com.facebook.presto.jdbc.PrestoResultSet);
}

Try / catch

try {
    rs.updateNCharacterStream(1, reader, len);
} catch (SQLFeatureNotSupportedException e) {
    throw new UnsupportedOperationException("Use PreparedStatement UPDATE; Presto result sets are read-only", e);
}

Prevention

When it happens

Trigger: Calling updateNCharacterStream(int columnIndex, Reader x, long length) on a Presto result set, typically after positioning on a row with intent to modify it in place.

Common situations: Code written against updatable result sets from other databases; attempt to patch data through the ResultSet instead of issuing SQL UPDATE via Statement; frameworks that optimistically use updatable result sets when CONCUR_UPDATABLE is requested.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/309ac5ca00370bd7. Report an issue: GitHub.