{"record":{"id":"8d9dd79f304bcbdf","repo":"prestodb/presto","slug":"exported-keys-not-supported","errorCode":null,"errorMessage":"exported keys not supported","messagePattern":"exported keys not supported","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"warning","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java","lineNumber":1035,"sourceCode":"    @Override\n    public ResultSet getPrimaryKeys(String catalog, String schema, String table)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"primary keys not supported\");\n    }\n\n    @Override\n    public ResultSet getImportedKeys(String catalog, String schema, String table)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"imported keys not supported\");\n    }\n\n    @Override\n    public ResultSet getExportedKeys(String catalog, String schema, String table)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"exported keys not supported\");\n    }\n\n    @Override\n    public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"cross reference not supported\");\n    }\n\n    @Override\n    public ResultSet getTypeInfo()\n            throws SQLException\n    {\n        return select(\"\" +\n                \"SELECT TYPE_NAME, DATA_TYPE, PRECISION, LITERAL_PREFIX, LITERAL_SUFFIX,\\n\" +\n                \"CREATE_PARAMS, NULLABLE, CASE_SENSITIVE, SEARCHABLE, UNSIGNED_ATTRIBUTE,\\n\" +\n                \"FIXED_PREC_SCALE, AUTO_INCREMENT, LOCAL_TYPE_NAME, MINIMUM_SCALE, MAXIMUM_SCALE,\\n\" +\n                \"SQL_DATA_TYPE, SQL_DATETIME_SUB, NUM_PREC_RADIX\\n\" +","sourceCodeStart":1017,"sourceCodeEnd":1053,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java#L1017-L1053","documentation":"getExportedKeys() in PrestoDatabaseMetaData always throws SQLFeatureNotSupportedException ('exported keys not supported'). Presto does not maintain or enforce foreign keys, so the driver cannot list keys that reference a given table. This is a deliberate unimplemented stub of the java.sql.DatabaseMetaData interface.","triggerScenarios":"Calling DatabaseMetaData.getExportedKeys(catalog, schema, table) on a Presto connection, typically from schema-browsing or data-modeling tools.","commonSituations":"ER diagram generators, DB migration/compare tools, ORMs introspecting referencing tables against Presto.","solutions":["Skip exported-key introspection for Presto connections; no FKs exist","Catch SQLFeatureNotSupportedException and substitute an empty result","Use INFORMATION_SCHEMA queries for the available metadata instead","Wrap the JDBC metadata access with a capability check / driver whitelist"],"exampleFix":"// before\nResultSet fk = meta.getExportedKeys(catalog, schema, table);\n// after\nResultSet fk;\ntry {\n    fk = meta.getExportedKeys(catalog, schema, table);\n} catch (SQLFeatureNotSupportedException e) {\n    fk = EMPTY_RESULT_SET;\n}","handlingStrategy":"try-catch","validationCode":"boolean supportsExportedKeys = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);","typeGuard":"boolean supportsExportedKeys = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);","tryCatchPattern":"try (ResultSet rs = meta.getExportedKeys(cat, schema, table)) { ... } catch (SQLFeatureNotSupportedException e) { /* empty FK set */ }","preventionTips":["Treat Presto as FK-less in data modeling tools","Skip exported-key introspection for Presto catalogs","Abstract metadata capability per backend"],"tags":["jdbc","unsupported-feature","metadata","foreign-keys"],"backgroundTag":"jdbc-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"}