prestodb/presto · info · SQLFeatureNotSupportedException
rowInserted
Error message
rowInserted
What it means
PrestoResultSet.rowInserted() is an unimplemented JDBC 4.x ResultSet method. The Presto JDBC driver only supports forward-only, read-only result sets, so all row-visibility and updatable-resultset methods throw SQLFeatureNotSupportedException with the method name as the message. There is no code path that returns normally from this method.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:760
public int getConcurrency()
throws SQLException
{
checkOpen();
return CONCUR_READ_ONLY;
}
@Override
public boolean rowUpdated()
throws SQLException
{
throw new SQLFeatureNotSupportedException("rowUpdated");
}
@Override
public boolean rowInserted()
throws SQLException
{
throw new SQLFeatureNotSupportedException("rowInserted");
}
@Override
public boolean rowDeleted()
throws SQLException
{
throw new SQLFeatureNotSupportedException("rowDeleted");
}
@Override
public void updateNull(int columnIndex)
throws SQLException
{
throw new SQLFeatureNotSupportedException("updateNull");
}
@Override
public void updateBoolean(int columnIndex, boolean x)View on GitHub (pinned to 55bb57d202)
Solutions
- Do not call rowInserted(); Presto result sets are read-only, so a row cannot have been inserted into them
- Check DatabaseMetaData.deletesAreDetected/insertsAreDetected (they report false for Presto) and skip visibility checks when they return false
- If you need insert feedback, run an INSERT statement and check its update count instead of probing the ResultSet
- Wrap generic JDBC code so these calls are only made when the result set was created with CONCUR_UPDATABLE, which Presto never supports
Example fix
// before
if (rs.rowInserted()) { handleInsert(); }
// after
DatabaseMetaData md = rs.getStatement().getConnection().getMetaData();
if (md.insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY) && rs.rowInserted()) { handleInsert(); } Defensive patterns
Strategy: try-catch
Validate before calling
DatabaseMetaData md = conn.getMetaData();
boolean supported = md.insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY); // false for Presto
if (!supported) { /* skip rowInserted() */ } Type guard
boolean supportsInsertDetection(Connection c) {
try { return c.getMetaData().insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY); }
catch (SQLException e) { return false; }
} Try / catch
try {
if (rs.rowInserted()) { /* ... */ }
} catch (SQLFeatureNotSupportedException e) {
// read-only driver: treat as not inserted
} Prevention
- Never call row-visibility methods (rowInserted/rowUpdated/rowDeleted) on Presto result sets
- Consult DatabaseMetaData.deletesAreDetected/insertsAreDetected before using visibility APIs
- Treat all Presto result sets as forward-only, read-only
- Use INSERT update counts for insert feedback instead
When it happens
Trigger: Calling rs.rowInserted() on any ResultSet obtained from a PrestoStatement or PrestoConnection, regardless of fetch direction, concurrency, or result contents.
Common situations: Generic JDBC framework code (ORMs, report tools, migration frameworks) that probes result-set capabilities or detects visible row updates on every ResultSet; running such a framework against Presto where it would use an updatable ResultSet against another database.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/a277e332ef70223e.
Report an issue: GitHub.