{"record":{"id":"233c97693189e29a","repo":"hibernate/hibernate-orm","slug":"unsupported-aggregate-sql-type-233c97","errorCode":null,"errorMessage":"Unsupported aggregate SQL type: {}","messagePattern":"Unsupported aggregate SQL type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/aggregate/PostgreSQLAggregateSupport.java","lineNumber":165,"sourceCode":"\t\t\t\t\t\t// We encode binary data as hex, so we have to decode here\n\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\t\"decode((select t.v from xmltable(\" + xmlExtractArguments( aggregateParentReadExpression, columnExpression )+ \" columns v text path '.') t),'hex')\"\n\t\t\t\t\t\t);\n\t\t\t\t\tcase ARRAY:\n\t\t\t\t\t\tthrow new UnsupportedOperationException( \"Transforming XML_ARRAY to native arrays is not supported on PostgreSQL!\" );\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\t\"(select t.v from xmltable(\" + xmlExtractArguments( aggregateParentReadExpression, columnExpression ) + \" columns v \" + getCastTypeName( column, typeConfiguration ) + \" path '.') t)\"\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\tcase STRUCT:\n\t\t\tcase STRUCT_ARRAY:\n\t\t\tcase STRUCT_TABLE:\n\t\t\t\treturn template.replace( placeholder, '(' + aggregateParentReadExpression + \").\" + columnExpression );\n\t\t}\n\t\tthrow new IllegalArgumentException( \"Unsupported aggregate SQL type: \" + aggregateColumnTypeCode );\n\t}\n\n\tprivate static String xmlExtractArguments(String aggregateParentReadExpression, String xpathFragment) {\n\t\tfinal String extractArguments;\n\t\tint separatorIndex;\n\t\tif ( aggregateParentReadExpression.startsWith( XML_EXTRACT_START )\n\t\t\t&& aggregateParentReadExpression.endsWith( XML_EXTRACT_END )\n\t\t\t&& (separatorIndex = aggregateParentReadExpression.indexOf( XML_EXTRACT_SEPARATOR )) != -1 ) {\n\t\t\tfinal var sb = new StringBuilder( aggregateParentReadExpression.length() - XML_EXTRACT_START.length() + xpathFragment.length() );\n\t\t\tsb.append( aggregateParentReadExpression, XML_EXTRACT_START.length(), separatorIndex );\n\t\t\tsb.append( '/' );\n\t\t\tsb.append( xpathFragment );\n\t\t\tsb.append( aggregateParentReadExpression, separatorIndex + 2, aggregateParentReadExpression.length() - XML_EXTRACT_END.length() );\n\t\t\textractArguments = sb.toString();\n\t\t}\n\t\telse if ( aggregateParentReadExpression.startsWith( XML_QUERY_START )\n\t\t\t\t&& aggregateParentReadExpression.endsWith( XML_QUERY_END )\n\t\t\t\t&& (separatorIndex = aggregateParentReadExpression.indexOf( XML_QUERY_SEPARATOR )) != -1 ) {","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/aggregate/PostgreSQLAggregateSupport.java#L147-L183","documentation":"Error \"Unsupported aggregate SQL type: {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Unsupported aggregate SQL type (PostgreSQL).","commonSituations":"Common when running against a database whose dialect lacks this capability, when a mapping or HQL/Criteria query requests unsupported functionality, or when the wrong dialect is configured for the database in use. Error: Unsupported aggregate SQL type (PostgreSQL).","solutions":["Map the aggregate column with a supported SQL type (JSON/ARRAY).","Avoid the unsupported aggregate type on PostgreSQL."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}