{"record":{"id":"2ef95e9579c0e7aa","repo":"prestodb/presto","slug":"primary-keys-not-supported","errorCode":null,"errorMessage":"primary keys not supported","messagePattern":"primary keys not supported","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"warning","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java","lineNumber":1021,"sourceCode":"    @Override\n    public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"row identifiers not supported\");\n    }\n\n    @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)","sourceCodeStart":1003,"sourceCodeEnd":1039,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java#L1003-L1039","documentation":"PrestoDatabaseMetaData.getPrimaryKeys() unconditionally throws SQLFeatureNotSupportedException. Presto tables are not keyed relational tables in the JDBC sense; primary key metadata is not available from the engine, so the driver rejects the call rather than returning an empty set.","triggerScenarios":"Calling DatabaseMetaData.getPrimaryKeys(catalog, schema, table); schema tools and ORMs discovering primary keys for entity mapping or join inference.","commonSituations":"Code generators (jOOQ, Hibernate reverse engineering) expecting PK metadata; ER-diagram tools; data cataloging tools importing schema from JDBC.","solutions":["Catch SQLFeatureNotSupportedException and treat tables as keyless","Derive keys from table properties/comments or your own schema definitions if applicable","Configure the code generator to work without primary keys (natural keys or no key strategy)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (md.getDatabaseProductName().contains(\"Presto\")) {\n    return Collections.emptyList(); // no primary key metadata\n}","typeGuard":null,"tryCatchPattern":"try (ResultSet rs = md.getPrimaryKeys(catalog, schema, table)) {\n    return readPrimaryKeys(rs);\n} catch (SQLFeatureNotSupportedException e) {\n    return Collections.emptyList();\n}","preventionTips":["Configure code generators to run without primary key metadata for Presto","Skip getPrimaryKeys in generic metadata crawlers","Model keys via table properties/comments and read those instead"],"tags":["jdbc","metadata","unsupported-feature","primary-key","presto"],"backgroundTag":"sqlfeaturenotsupported","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"}