prestodb/presto · warning · SQLFeatureNotSupportedException
exported keys not supported
Error message
exported keys not supported
What it means
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.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java:1035
@Override
public ResultSet getPrimaryKeys(String catalog, String schema, String table)
throws SQLException
{
throw new SQLFeatureNotSupportedException("primary keys not supported");
}
@Override
public ResultSet getImportedKeys(String catalog, String schema, String table)
throws SQLException
{
throw new SQLFeatureNotSupportedException("imported keys not supported");
}
@Override
public ResultSet getExportedKeys(String catalog, String schema, String table)
throws SQLException
{
throw new SQLFeatureNotSupportedException("exported keys not supported");
}
@Override
public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable)
throws SQLException
{
throw new SQLFeatureNotSupportedException("cross reference not supported");
}
@Override
public ResultSet getTypeInfo()
throws SQLException
{
return select("" +
"SELECT TYPE_NAME, DATA_TYPE, PRECISION, LITERAL_PREFIX, LITERAL_SUFFIX,\n" +
"CREATE_PARAMS, NULLABLE, CASE_SENSITIVE, SEARCHABLE, UNSIGNED_ATTRIBUTE,\n" +
"FIXED_PREC_SCALE, AUTO_INCREMENT, LOCAL_TYPE_NAME, MINIMUM_SCALE, MAXIMUM_SCALE,\n" +
"SQL_DATA_TYPE, SQL_DATETIME_SUB, NUM_PREC_RADIX\n" +View on GitHub (pinned to 55bb57d202)
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
Example fix
// before
ResultSet fk = meta.getExportedKeys(catalog, schema, table);
// after
ResultSet fk;
try {
fk = meta.getExportedKeys(catalog, schema, table);
} catch (SQLFeatureNotSupportedException e) {
fk = EMPTY_RESULT_SET;
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean supportsExportedKeys = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);
Type guard
boolean supportsExportedKeys = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);
Try / catch
try (ResultSet rs = meta.getExportedKeys(cat, schema, table)) { ... } catch (SQLFeatureNotSupportedException e) { /* empty FK set */ } Prevention
- Treat Presto as FK-less in data modeling tools
- Skip exported-key introspection for Presto catalogs
- Abstract metadata capability per backend
When it happens
Trigger: Calling DatabaseMetaData.getExportedKeys(catalog, schema, table) on a Presto connection, typically from schema-browsing or data-modeling tools.
Common situations: ER diagram generators, DB migration/compare tools, ORMs introspecting referencing tables against Presto.
Related errors
- imported keys not supported
- cross reference not supported
- privileges not supported
- row identifiers not supported
- version columns not supported
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/8d9dd79f304bcbdf.
Report an issue: GitHub.