{"record":{"id":"481c8746e256623b","repo":"prestodb/presto","slug":"cross-reference-not-supported","errorCode":null,"errorMessage":"cross reference not supported","messagePattern":"cross reference not supported","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"warning","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java","lineNumber":1042,"sourceCode":"    @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\" +\n                \"FROM system.jdbc.types\\n\" +\n                \"ORDER BY DATA_TYPE\");\n    }\n\n    @Override\n    public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate)\n            throws SQLException","sourceCodeStart":1024,"sourceCodeEnd":1060,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java#L1024-L1060","documentation":"getCrossReference() in PrestoDatabaseMetaData unconditionally throws SQLFeatureNotSupportedException ('cross reference not supported'). Cross-reference metadata (which keys of one table reference keys of another) cannot be provided because Presto has no foreign-key concept. The stub exists only to satisfy the DatabaseMetaData interface.","triggerScenarios":"Calling DatabaseMetaData.getCrossReference(parentCatalog, parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable) on a Presto connection.","commonSituations":"Schema diffing tools, ER diagram tools, JDBC-aware IDEs comparing referential structure across catalogs.","solutions":["Do not request cross-reference metadata from Presto; treat all FK relations as absent","Catch SQLFeatureNotSupportedException and return an empty result set","Derive relationships from application-level knowledge or INFORMATION_SCHEMA if needed","File/track upstream support if Presto ever exposes FK metadata"],"exampleFix":"// before\nResultSet xref = meta.getCrossReference(pc, ps, pt, fc, fs, ft);\n// after\nResultSet xref;\ntry {\n    xref = meta.getCrossReference(pc, ps, pt, fc, fs, ft);\n} catch (SQLFeatureNotSupportedException e) {\n    xref = EMPTY_RESULT_SET;\n}","handlingStrategy":"try-catch","validationCode":"boolean supportsCrossReference = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);","typeGuard":"boolean supportsCrossReference = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);","tryCatchPattern":"try (ResultSet rs = meta.getCrossReference(pc, ps, pt, fc, fs, ft)) { ... } catch (SQLFeatureNotSupportedException e) { /* no cross references */ }","preventionTips":["Avoid ER/diff tooling that depends on cross-reference metadata for Presto","Return empty relation sets when the driver is Presto","Keep JDBC metadata usage behind a capability interface"],"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"}