{"record":{"id":"624a514591e23ab7","repo":"hibernate/hibernate-orm","slug":"database-doesn-t-support-extracting-all-indexes-at","errorCode":null,"errorMessage":"Database doesn't support extracting all indexes at once","messagePattern":"Database doesn't support extracting all indexes at once","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java","lineNumber":1216,"sourceCode":"\n\tprivate static IndexInformationImpl.Builder indexInformationBuilder(\n\t\t\tMap<Identifier, IndexInformationImpl.Builder> builders,\n\t\t\tIdentifier indexIdentifier) {\n\t\tfinal var builder = builders.get( indexIdentifier );\n\t\tif ( builder == null ) {\n\t\t\tfinal var newBuilder = IndexInformationImpl.builder( indexIdentifier );\n\t\t\tbuilders.put( indexIdentifier, newBuilder );\n\t\t\treturn newBuilder;\n\t\t}\n\t\telse {\n\t\t\treturn builder;\n\t\t}\n\t}\n\n\t@Override\n\tpublic NameSpaceIndexesInformation getIndexes(Identifier catalog, Identifier schema) {\n\t\tif ( !supportsBulkIndexRetrieval() ) {\n\t\t\tthrow new UnsupportedOperationException( \"Database doesn't support extracting all indexes at once\" );\n\t\t}\n\t\telse {\n\t\t\ttry {\n\t\t\t\treturn processIndexInfoResultSet(\n\t\t\t\t\t\tcatalog == null ? \"\" : catalog.getText(),\n\t\t\t\t\t\tschema == null ? \"\" : schema.getText(),\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tthis::extractNameSpaceIndexesInformation\n\t\t\t\t);\n\t\t\t}\n\t\t\tcatch (SQLException e) {\n\t\t\t\tthrow convertSQLException( e,\n\t\t\t\t\t\t\"Error while reading index information for namespace \"\n\t\t\t\t\t\t+ new Namespace.Name( catalog, schema ) );\n\t\t\t}\n\t\t}","sourceCodeStart":1198,"sourceCodeEnd":1234,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java#L1198-L1234","documentation":"InformationExtractor#getIndexes(Identifier, Identifier) is the namespace-wide (bulk) index retrieval entry point, guarded by supportsBulkIndexRetrieval(). When the active extractor/dialect cannot fetch all indexes in one query, calling it throws UnsupportedOperationException — indexes must then be fetched table by table.","triggerScenarios":"Calling extractor.getIndexes(catalog, schema) for a whole namespace while the active extractor reports supportsBulkIndexRetrieval() == false — custom dialect/extractor overrides, or tooling performing namespace-wide index scans on such setups.","commonSituations":"Custom InformationExtractor implementations; reverse-engineering or schema-diff tools iterating whole schemas; grouped schema management on databases without a usable bulk index query.","solutions":["Fetch per table: getTable(catalog, schema, table).getIndexes() instead of the namespace-wide call.","If you own the extractor, implement the bulk index path and make supportsBulkIndexRetrieval() return true.","Catch UnsupportedOperationException and degrade to per-table iteration."],"exampleFix":"// before\nNameSpaceIndexesInformation all = extractor.getIndexes(catalog, schema); // may throw\n\n// after\nNameSpaceIndexesInformation all;\ntry {\n    all = extractor.getIndexes(catalog, schema);\n} catch (UnsupportedOperationException e) {\n    all = null; // degrade to per-table retrieval\n    for (TableInformation t : extractor.getTables(catalog, schema, null)) {\n        t.getIndexes();\n    }\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"NameSpaceIndexesInformation all;\ntry {\n    all = extractor.getIndexes(catalog, schema);\n} catch (UnsupportedOperationException e) {\n    all = null; // bulk not supported — fall back to per-table retrieval\n    for (TableInformation t : extractor.getTables(catalog, schema, null)) {\n        t.getIndexes();\n    }\n}","preventionTips":["Prefer per-table index retrieval when supporting multiple databases.","Document bulk-capability overrides in custom dialects/extraction contexts.","Wrap namespace-wide extraction behind a helper that degrades gracefully."],"tags":["hibernate","schema-extraction","index","unsupported-operation","dialect"],"backgroundTag":"unsupported-bulk-metadata-extraction","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}