{"record":{"id":"a718b2dcca2c8b9b","repo":"prestodb/presto","slug":"createarrayof","errorCode":null,"errorMessage":"createArrayOf","messagePattern":"createArrayOf","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java","lineNumber":581,"sourceCode":"        return clientInfo.get(name);\n    }\n\n    @Override\n    public Properties getClientInfo()\n            throws SQLException\n    {\n        Properties properties = new Properties();\n        for (Map.Entry<String, String> entry : clientInfo.entrySet()) {\n            properties.setProperty(entry.getKey(), entry.getValue());\n        }\n        return properties;\n    }\n\n    @Override\n    public Array createArrayOf(String typeName, Object[] elements)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"createArrayOf\");\n    }\n\n    @Override\n    public Struct createStruct(String typeName, Object[] attributes)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"createStruct\");\n    }\n\n    @Override\n    public void setSchema(String schema)\n            throws SQLException\n    {\n        checkOpen();\n        this.schema.set(schema);\n    }\n\n    @Override","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java#L563-L599","documentation":"PrestoConnection.createArrayOf(String typeName, Object[] elements) unconditionally throws SQLFeatureNotSupportedException(\"createArrayOf\"). The driver does not implement client-side java.sql.Array creation; the stub fails before any request. ARRAY parameters must be passed as native Java arrays/collections instead.","triggerScenarios":"Calling connection.createArrayOf(\"bigint\", elements) and then PreparedStatement.setArray with the result.","commonSituations":"Generic data pipelines binding Presto ARRAY columns; migrations from drivers (Postgres) where createArrayOf is the standard way to bind arrays.","solutions":["Pass the array directly via ps.setObject(1, elements) — the driver maps Java arrays/collections to Presto ARRAY types","Build ARRAY literals in SQL text with an explicit CAST when precise element typing is needed","Catch SQLFeatureNotSupportedException and switch to the setObject path"],"exampleFix":"// before\nArray arr = connection.createArrayOf(\"bigint\", new Long[]{1L, 2L});\nps.setArray(1, arr);\n// after\nps.setObject(1, new Long[]{1L, 2L});","handlingStrategy":"try-catch","validationCode":"DatabaseMetaData meta = connection.getMetaData();\nif (meta.getDriverName().contains(\"Presto\")) {\n    // bind arrays via setObject, not createArrayOf\n}","typeGuard":"static boolean supportsCreateArray(DatabaseMetaData meta) throws SQLException {\n    return !meta.getDriverName().contains(\"Presto\");\n}","tryCatchPattern":"try {\n    Array arr = connection.createArrayOf(\"bigint\", elements);\n    ps.setArray(1, arr);\n} catch (SQLFeatureNotSupportedException e) {\n    ps.setObject(1, elements); // driver maps arrays/collections to ARRAY\n}","preventionTips":["Pass Java arrays/collections with setObject for ARRAY columns","Avoid java.sql.Array in shared binding code; use driver-agnostic setObject","Cover ARRAY parameter binding in integration tests"],"tags":["jdbc","presto","unsupported-operation","array"],"backgroundTag":"sql-feature-not-supported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}