prestodb/presto · error · SQLFeatureNotSupportedException

updateAsciiStream

Error message

updateAsciiStream

What it means

PrestoResultSet.updateAsciiStream(int, InputStream, int) always throws SQLFeatureNotSupportedException("updateAsciiStream"). The Presto JDBC driver implements read-only result sets; streaming update methods are interface-compliance stubs that reject use. Character stream data cannot be written into a row through the cursor.

Source

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

    @Override
    public void updateTime(int columnIndex, Time x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateTime");
    }

    @Override
    public void updateTimestamp(int columnIndex, Timestamp x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateTimestamp");
    }

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

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

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

    @Override
    public void updateObject(int columnIndex, Object x, int scaleOrLength)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Load the stream into a String or Reader in application code, then execute a parameterized UPDATE with setString/setCharacterStream semantics.
  2. Use Presto's file/text ingestion (e.g. INSERT via Hive connector, or INSERT INTO ... SELECT from staged data) for bulk text loading.
  3. Request CONCUR_READ_ONLY so no code path assumes updatable cursors.
  4. Mark the Presto datasource read-only in framework configuration.

Example fix

// before
rs.updateAsciiStream("notes", in, length);
rs.updateRow();
// after
String text = new String(in.readAllBytes(), StandardCharsets.US_ASCII);
try (PreparedStatement ps = conn.prepareStatement("UPDATE docs SET notes = ? WHERE id = ?")) {
    ps.setString(1, text);
    ps.setLong(2, id);
    ps.executeUpdate();
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {
    // Presto: materialize stream and use UPDATE with setString instead of updateAsciiStream
}

Type guard

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

Try / catch

try {
    rs.updateAsciiStream("notes", in, length);
    rs.updateRow();
} catch (SQLFeatureNotSupportedException e) {
    // read the stream, then executeUpdate with setString
}

Prevention

When it happens

Trigger: Calling updateAsciiStream(columnIndex, stream, length) (or the label/length variants) on a PrestoResultSet, typically to set a large VARCHAR column from a stream before updateRow().

Common situations: LOB-handling code ported from Oracle/MySQL JDBC usage; ingesting text files into a table row by row via cursor updates; persistence frameworks that stream large values into updatable result sets.

Related errors


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