{"record":{"id":"d812243ac2545acb","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-d81224","errorCode":null,"errorMessage":"Summarization is not supported by DBMS!","messagePattern":"Summarization is not supported by DBMS!","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/IngresSqlAstTranslator.java","lineNumber":111,"sourceCode":"\t@Override\n\tprotected void renderSelectTupleComparison(\n\t\t\tList<SqlSelection> lhsExpressions,\n\t\t\tSqlTuple tuple,\n\t\t\tComparisonOperator operator) {\n\t\temulateSelectTupleComparison( lhsExpressions, tuple.getExpressions(), operator, true );\n\t}\n\n\t@Override\n\tprotected void renderPartitionItem(Expression expression) {\n\t\tif ( expression instanceof Literal ) {\n\t\t\t// Note that this depends on the SqmToSqlAstConverter to add a dummy table group\n\t\t\tappendSql( \"dummy_.x\" );\n\t\t}\n\t\telse if ( expression instanceof Summarization ) {\n\t\t\t// This could theoretically be emulated by rendering all grouping variations of the query and\n\t\t\t// connect them via union all but that's probably pretty inefficient and would have to happen\n\t\t\t// on the query spec level\n\t\t\tthrow new UnsupportedOperationException( \"Summarization is not supported by DBMS!\" );\n\t\t}\n\t\telse {\n\t\t\texpression.accept( this );\n\t\t}\n\t}\n\n\t@Override\n\tprotected boolean needsRowsToSkip() {\n\t\treturn !supportsOffsetFetchClause();\n\t}\n\n\tprivate boolean supportsParameterOffsetFetchExpression() {\n\t\treturn getDialect().getVersion().isSameOrAfter( 9, 3 );\n\t}\n\n\tprivate boolean supportsOffsetFetchClause() {\n\t\treturn getDialect().getVersion().isSameOrAfter( 9, 3 );\n\t}","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/IngresSqlAstTranslator.java#L93-L129","documentation":"IngresSqlAstTranslator.renderPartitionItem() throws when the GROUP BY contains a Summarization expression (ROLLUP / GROUPING SETS). As the comment explains, the only emulation would be to render every grouping variation of the whole query spec and union them, which cannot be done at the individual partition-item level, so the query is rejected with UnsupportedOperationException.","triggerScenarios":"Executing HQL or criteria with 'group by rollup(...)' or 'group by grouping sets(...)' on the Ingres dialect; the Summarization node reaches renderPartitionItem() during translation to SQL.","commonSituations":"Report/OLAP queries reused across databases being enabled on Ingres; migrations from Oracle reporting schemas; attempting subtotal-style output in a shared DAO layer.","solutions":["Rewrite as multiple grouped queries combined with UNION ALL (one per grouping level plus a grand total)","Aggregate in Java after fetching detail rows","Use a native query targeting Ingres-specific syntax if available"],"exampleFix":"// before\n\"select c.country, c.city, sum(c.sales) from City c group by rollup(c.country, c.city)\"\n\n// after\n\"select c.country, c.city, sum(c.sales) from City c group by c.country, c.city\" +\n\" union all \" +\n\"select c.country, null, sum(c.sales) from City c group by c.country\" +\n\" union all \" +\n\"select null, null, sum(c.sales) from City c\"","handlingStrategy":"try-catch","validationCode":"static boolean dialectSupportsSummarization(Dialect d) {\n    return !(d instanceof IngresDialect);\n}\nif ( !dialectSupportsSummarization(session.getJdbcServices().getDialect())\n        && hql.toLowerCase().matches(\"(?s).*(rollup|grouping\\\\s+sets)\\\\s*\\\\(.*\") ) {\n    // rewrite as union-all\n}","typeGuard":"static boolean isIngres(Dialect d) { return d instanceof IngresDialect; }","tryCatchPattern":"try {\n    return session.createQuery(hql, Object[].class).getResultList();\n} catch (UnsupportedOperationException e) {\n    if ( String.valueOf(e.getMessage()).contains(\"Summarization\") ) {\n        return runUnionAllFallback(hql);\n    }\n    throw e;\n}","preventionTips":["Isolate grouping-set analytics from portable JPQL","Cover report queries with per-dialect integration tests","Compute subtotals in the application layer when many dialects must be supported"],"tags":["hibernate","ingres","group-by","rollup","grouping-sets","dialect"],"backgroundTag":"dialect-unsupported-sql-feature","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}