prestodb/presto · error · SQLFeatureNotSupportedException
getCursorName
Error message
getCursorName
What it means
getCursorName is not supported: Presto queries are non-positional, forward-only, unnamed result streams, so there is no cursor name to return. PrestoResultSet throws SQLFeatureNotSupportedException unconditionally. The JDBC cursor-name mechanism (used with positioned UPDATE/DELETE) does not map to Presto's execution model.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:504
throws SQLException
{
checkOpen();
return warningsManager.getWarnings();
}
@Override
public void clearWarnings()
throws SQLException
{
checkOpen();
warningsManager.clearWarnings();
}
@Override
public String getCursorName()
throws SQLException
{
throw new SQLFeatureNotSupportedException("getCursorName");
}
@Override
public ResultSetMetaData getMetaData()
throws SQLException
{
return resultSetMetaData;
}
@Override
public Object getObject(int columnIndex)
throws SQLException
{
ColumnInfo columnInfo = columnInfo(columnIndex);
switch (columnInfo.getColumnType()) {
case Types.DATE:
return getDate(columnIndex);
case Types.TIME:View on GitHub (pinned to 55bb57d202)
Solutions
- Remove the getCursorName call — positioned updates via cursor name are impossible in Presto by design
- Perform updates with explicit keyed SQL statements (WHERE pk = ?) instead of positioned updates
- Check ResultSetMetaData/DatabaseMetaData capabilities before invoking cursor-based APIs
Example fix
// before
String cursor = rs.getCursorName();
stmt.executeUpdate("DELETE FROM t WHERE CURRENT OF " + cursor);
// after
stmt.executeUpdate("DELETE FROM t WHERE id = ?", rs.getLong("id")); // use explicit key predicates Defensive patterns
Strategy: try-catch
Validate before calling
// positioned updates are impossible in Presto; detect the driver before any cursor-name usage
if (jdbcUrl.startsWith("jdbc:presto:")) {
throw new UnsupportedOperationException("Cursor names / positioned updates are not supported by Presto");
} Try / catch
try {
String cursor = rs.getCursorName();
} catch (SQLFeatureNotSupportedException e) {
// fall back to explicit keyed UPDATE/DELETE statements
} Prevention
- Never use positioned UPDATE/DELETE (CURRENT OF) with Presto
- Always issue updates with explicit primary-key predicates
- Probe capabilities via DatabaseMetaData rather than assuming JDBC feature parity
When it happens
Trigger: Calling rs.getCursorName() on a PrestoResultSet, typically in code that supports updatable-result-set / positioned-update workflows.
Common situations: Legacy database middleware that resolves cursor names for positioned DML; framework code probing cursor capabilities on every ResultSet.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/c8d014ee21b1b48d.
Report an issue: GitHub.