prestodb/presto · error · SQLFeatureNotSupportedException

moveToCurrentRow

Error message

moveToCurrentRow

What it means

moveToCurrentRow() returns the cursor from the insert row back to the current row and requires updatable-result-set support. Presto's PrestoResultSet always throws SQLFeatureNotSupportedException("moveToCurrentRow").

Source

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

    @Override
    public void cancelRowUpdates()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("cancelRowUpdates");
    }

    @Override
    public void moveToInsertRow()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("moveToInsertRow");
    }

    @Override
    public void moveToCurrentRow()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("moveToCurrentRow");
    }

    @Override
    public Statement getStatement()
    {
        return statement;
    }

    @Override
    public Object getObject(int columnIndex, Map<String, Class<?>> map)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getObject");
    }

    @Override
    public Ref getRef(int columnIndex)
            throws SQLException

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Remove moveToInsertRow/moveToCurrentRow usage entirely; on Presto the cursor never leaves the current row
  2. Route all inserts through SQL INSERT statements
  3. Place such calls behind a concurrency/type capability check

Example fix

// before
rs.moveToInsertRow();
// ... updates ...
rs.insertRow();
rs.moveToCurrentRow();
// after
try (PreparedStatement ps = conn.prepareStatement(
        "INSERT INTO orders (name) VALUES (?)")) {
    ps.setString(1, name);
    ps.executeUpdate();
}
// cursor position is unaffected by SQL inserts
Defensive patterns

Strategy: validation

Validate before calling

if (rs.getConcurrency() != ResultSet.CONCUR_UPDATABLE) {
    // cursor never left the current row; no need for moveToCurrentRow()
}

Try / catch

try {
    rs.moveToCurrentRow();
} catch (SQLFeatureNotSupportedException e) {
    // no-op on Presto: cursor is always on the current row
}

Prevention

When it happens

Trigger: Calling moveToCurrentRow() on a PrestoResultSet, typically as cleanup after moveToInsertRow()-based insert attempts (which themselves fail first).

Common situations: Cleanup/finally blocks in cursor-insert code ported from other databases; generic JDBC frameworks that unconditionally restore cursor position.

Related errors


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