{"record":{"id":"a0546becddd1f363","repo":"prestodb/presto","slug":"imported-keys-not-supported","errorCode":null,"errorMessage":"imported keys not supported","messagePattern":"imported keys not supported","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"warning","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java","lineNumber":1028,"sourceCode":"    @Override\n    public ResultSet getVersionColumns(String catalog, String schema, String table)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"version columns not supported\");\n    }\n\n    @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()","sourceCodeStart":1010,"sourceCodeEnd":1046,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java#L1010-L1046","documentation":"getImportedKeys() in PrestoDatabaseMetaData is unimplemented and unconditionally throws SQLFeatureNotSupportedException with message 'imported keys not supported'. Presto's SQL engine does not expose foreign-key metadata, so the JDBC driver cannot report which keys a table imports. Any JDBC tool that calls this metadata method will fail.","triggerScenarios":"Calling DatabaseMetaData.getImportedKeys(catalog, schema, table) on a PrestoConnection, e.g. from an IDE schema browser or an ORM that inspects foreign keys.","commonSituations":"IntelliJ/Eclipse/DBeaver table introspection, Hibernate/JPA schema validation or reverse engineering, migration tools that map referential integrity.","solutions":["Avoid calling getImportedKeys on Presto; Presto tables have no enforced foreign keys, so treat the result as an empty set in caller code","Catch SQLFeatureNotSupportedException and return an empty ResultSet-like structure / skip FK processing","Use a metadata bridge (e.g. query INFORMATION_SCHEMA.TABLES/COLUMNS) instead of JDBC FK metadata","File/track the upstream TODO to implement the method if FK metadata becomes available"],"exampleFix":"// before\nResultSet fk = meta.getImportedKeys(catalog, schema, table);\n// after\nResultSet fk;\ntry {\n    fk = meta.getImportedKeys(catalog, schema, table);\n} catch (SQLFeatureNotSupportedException e) {\n    fk = EMPTY_RESULT_SET; // Presto has no foreign keys\n}","handlingStrategy":"try-catch","validationCode":"// Presto never supports FK metadata; gate the call\ndatabaseMetaDataCapability = (meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData) ? false : true;","typeGuard":"boolean supportsImportedKeys = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);","tryCatchPattern":"try (ResultSet rs = meta.getImportedKeys(cat, schema, table)) { ... } catch (SQLFeatureNotSupportedException e) { /* treat as no foreign keys */ }","preventionTips":["Check driver metadata support before calling FK-related DatabaseMetaData methods","Centralize JDBC metadata access in a helper that degrades gracefully per driver","Do not run ORM schema validation tools that require FK metadata against Presto"],"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"}