prestodb/presto · error · SQLFeatureNotSupportedException
relative
Error message
relative
What it means
PrestoResultSet throws SQLFeatureNotSupportedException("relative") because the driver supports only forward-only iteration; moving a relative number of rows (forward or backward) from the current position is not supported without buffering.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:685
@Override
public int getRow()
throws SQLException
{
throw new SQLFeatureNotSupportedException("getRow");
}
@Override
public boolean absolute(int row)
throws SQLException
{
throw new SQLFeatureNotSupportedException("absolute");
}
@Override
public boolean relative(int rows)
throws SQLException
{
throw new SQLFeatureNotSupportedException("relative");
}
@Override
public boolean previous()
throws SQLException
{
throw new SQLFeatureNotSupportedException("previous");
}
@Override
public void setFetchDirection(int direction)
throws SQLException
{
checkOpen();
if (direction != FETCH_FORWARD) {
throw new SQLException("Fetch direction must be FETCH_FORWARD");
}
}View on GitHub (pinned to 55bb57d202)
Solutions
- Skip forward rows with a plain loop over rs.next()
- Include the skip in SQL with LIMIT/OFFSET or a window function
- Re-execute the query if backward movement is required
Example fix
// before
rs.relative(10);
// after
for (int i = 0; i < 10 && rs.next(); i++) { /* skip */ } Defensive patterns
Strategy: try-catch
Validate before calling
DatabaseMetaData md = conn.getMetaData();
if (!md.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)) { /* skip rows with next() */ } Try / catch
try { rs.relative(n); } catch (SQLFeatureNotSupportedException e) { /* loop rs.next() n times */ } Prevention
- Skip forward rows with an explicit next() loop
- Never move backward; re-run the query instead
- Prefer SQL-side offset/skip logic
When it happens
Trigger: Calling ResultSet.relative(int rows) on a PrestoResultSet, including relative(0) to refresh the current row.
Common situations: Code ported from scrollable-result-set databases that steps N rows at a time or skips rows via relative().
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/a3cbad70798b1bbc.
Report an issue: GitHub.