{"record":{"id":"996eb2a2dfaaf1ef","repo":"apache/shardingsphere","slug":"getarray-996eb2","errorCode":null,"errorMessage":"getArray","messagePattern":"getArray","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java","lineNumber":112,"sourceCode":"    \n    @Override\n    public final Timestamp getTimestamp(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getTimestamp\");\n    }\n    \n    @Override\n    public final Timestamp getTimestamp(final int columnIndex, final Calendar cal) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getTimestamp\");\n    }\n    \n    @Override\n    public final Timestamp getTimestamp(final String columnLabel, final Calendar cal) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getTimestamp\");\n    }\n    \n    @Override\n    public final Array getArray(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getArray\");\n    }\n    \n    @Override\n    public final Array getArray(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getArray\");\n    }\n    \n    @Override\n    public final InputStream getAsciiStream(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getAsciiStream\");\n    }\n    \n    @Override\n    public final InputStream getAsciiStream(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getAsciiStream\");\n    }\n    \n    @Override","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java#L94-L130","documentation":"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.","triggerScenarios":"Calling rs.getArray(1) on the getGeneratedKeys() result set after an INSERT through the ShardingSphere driver.","commonSituations":"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.","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."],"exampleFix":"// before\nArray a = rs.getArray(1);\n\n// after\nObject key = rs.getObject(1); // generated keys are scalar","handlingStrategy":"try-catch","validationCode":"Object key = rs.getObject(1); // generated keys are scalar; never arrays","typeGuard":"static boolean isShardingGeneratedKeys(ResultSet rs) {\n    return rs.getClass().getName().endsWith(\"GeneratedKeysResultSet\");\n}","tryCatchPattern":"try {\n    arr = rs.getArray(1);\n} catch (SQLFeatureNotSupportedException e) {\n    Object key = rs.getObject(1); // handle scalar directly\n}","preventionTips":["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."],"tags":["jdbc","shardingsphere","generated-keys","resultset","sql-feature-not-supported","array"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}