apache/shardingsphere · error · SQLFeatureNotSupportedException
getArray
Error message
getArray
What it means
getArray(int columnIndex) is final and always throws in AbstractUnsupportedGeneratedKeysResultSet. Generated keys are single scalar Comparable values per row; there is no array-valued column, so java.sql.Array extraction is unimplemented by design.
Source
Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java:112
@Override
public final Timestamp getTimestamp(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getTimestamp");
}
@Override
public final Timestamp getTimestamp(final int columnIndex, final Calendar cal) throws SQLException {
throw new SQLFeatureNotSupportedException("getTimestamp");
}
@Override
public final Timestamp getTimestamp(final String columnLabel, final Calendar cal) throws SQLException {
throw new SQLFeatureNotSupportedException("getTimestamp");
}
@Override
public final Array getArray(final int columnIndex) throws SQLException {
throw new SQLFeatureNotSupportedException("getArray");
}
@Override
public final Array getArray(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getArray");
}
@Override
public final InputStream getAsciiStream(final int columnIndex) throws SQLException {
throw new SQLFeatureNotSupportedException("getAsciiStream");
}
@Override
public final InputStream getAsciiStream(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getAsciiStream");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Use rs.getObject(1) or rs.getString(1); a generated key is never an SQL array.
- Remove array-handling branches from generated-key processing code.
- Catch SQLFeatureNotSupportedException and skip/ignore the column as a defensive measure.
Example fix
// before Array a = rs.getArray(1); // after Object key = rs.getObject(1); // generated keys are scalar
Defensive patterns
Strategy: try-catch
Validate before calling
Object key = rs.getObject(1); // generated keys are scalar; never arrays
Type guard
static boolean isShardingGeneratedKeys(ResultSet rs) {
return rs.getClass().getName().endsWith("GeneratedKeysResultSet");
} Try / catch
try {
arr = rs.getArray(1);
} catch (SQLFeatureNotSupportedException e) {
Object key = rs.getObject(1); // handle scalar directly
} Prevention
- Remove array-getter branches from generated-key processing.
- Use getObject when the mapper must stay generic.
- Treat SQLFeatureNotSupportedException as a signal to simplify the code path, not just to swallow.
When it happens
Trigger: Calling rs.getArray(1) on the getGeneratedKeys() result set after an INSERT through the ShardingSphere driver.
Common situations: Generic reflection-based row mappers that try typed getters including getArray for every column type. Code copied from vendor-driver projects where getArray returned null or an empty Array instead of throwing.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/996eb2a2dfaaf1ef.
Report an issue: GitHub.