{"record":{"id":"96fec7a182bb5ca3","repo":"hibernate/hibernate-orm","slug":"argument-passed-to-function-unnest-is-not-a-colu","errorCode":null,"errorMessage":"Argument passed to function 'unnest' is not a column reference, but an aggregate type, which is not yet supported.","messagePattern":"Argument passed to function 'unnest' is not a column reference, but an aggregate type, which is not yet supported\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/function/array/H2UnnestFunction.java","lineNumber":261,"sourceCode":"\t\t\t\t\tnull,\n\t\t\t\t\tnull,\n\t\t\t\t\tnull,\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tconverter.getCreationContext().getTypeConfiguration().getBasicTypeForJavaType( Long.class )\n\t\t\t) : null;\n\n\t\t\tfinal BasicType<?> elementType = pluralType.getElementType();\n\t\t\tfinal SelectableMapping[] returnType;\n\t\t\tif ( elementType.getJdbcType() instanceof AggregateJdbcType aggregateJdbcType\n\t\t\t\t\t&& aggregateJdbcType.getEmbeddableMappingType() != null ) {\n\t\t\t\tfinal ColumnReference arrayColumnReference = expression.getColumnReference();\n\t\t\t\tif ( arrayColumnReference == null ) {\n\t\t\t\t\tthrow new IllegalArgumentException( \"Argument passed to function 'unnest' is not a column reference, but an aggregate type, which is not yet supported.\" );\n\t\t\t\t}\n\t\t\t\t// For column references we render an emulation through system_range(),\n\t\t\t\t// so we need to render an array access to get to the element\n\t\t\t\tfinal String elementReadExpression = arrayColumnReference.getExpressionText() + \"[\" + Template.TEMPLATE + \".x]\";\n\t\t\t\tfinal EmbeddableMappingType embeddableMappingType = aggregateJdbcType.getEmbeddableMappingType();\n\t\t\t\tfinal int jdbcValueCount = embeddableMappingType.getJdbcValueCount();\n\t\t\t\treturnType = new SelectableMapping[jdbcValueCount + (indexMapping == null ? 0 : 1)];\n\t\t\t\tfor ( int i = 0; i < jdbcValueCount; i++ ) {\n\t\t\t\t\tfinal SelectableMapping selectableMapping = embeddableMappingType.getJdbcValueSelectable( i );\n\t\t\t\t\t// The array expression has to be replaced with the actual array_get read expression in this emulation\n\t\t\t\t\tfinal String customReadExpression = selectableMapping.getCustomReadExpression()\n\t\t\t\t\t\t\t.replace( Template.TEMPLATE, elementReadExpression );\n\t\t\t\t\treturnType[i] = new SelectableMappingImpl(\n\t\t\t\t\t\t\tselectableMapping.getContainingTableExpression(),\n\t\t\t\t\t\t\tselectableMapping.getSelectablePath().getSelectableName(),\n\t\t\t\t\t\t\tnew SelectablePath( selectableMapping.getSelectablePath().getSelectableName() ),\n\t\t\t\t\t\t\tcustomReadExpression,\n\t\t\t\t\t\t\tselectableMapping.getCustomWriteExpression(),","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/array/H2UnnestFunction.java#L243-L279","documentation":"Error \"Argument passed to function 'unnest' is not a column reference, but an aggregate type, which is not yet supported.\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Argument passed to function 'unnest' is not a column reference, but an aggregate type, which is not yet supported..","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: Argument passed to function 'unnest' is not a column reference, but an aggregate type, which is not yet supported..","solutions":["Pass a column reference to unnest() instead of an aggregate expression."],"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"}