hibernate/hibernate-orm · error · IllegalArgumentException

Argument passed to function 'unnest' is not a column referen

Error message

Argument passed to function 'unnest' is not a column reference, but an aggregate type, which is not yet supported.

What it means

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.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/array/H2UnnestFunction.java:261

					null,
					null,
					null,
					false,
					false,
					false,
					false,
					false,
					false,
					converter.getCreationContext().getTypeConfiguration().getBasicTypeForJavaType( Long.class )
			) : null;

			final BasicType<?> elementType = pluralType.getElementType();
			final SelectableMapping[] returnType;
			if ( elementType.getJdbcType() instanceof AggregateJdbcType aggregateJdbcType
					&& aggregateJdbcType.getEmbeddableMappingType() != null ) {
				final ColumnReference arrayColumnReference = expression.getColumnReference();
				if ( arrayColumnReference == null ) {
					throw new IllegalArgumentException( "Argument passed to function 'unnest' is not a column reference, but an aggregate type, which is not yet supported." );
				}
				// For column references we render an emulation through system_range(),
				// so we need to render an array access to get to the element
				final String elementReadExpression = arrayColumnReference.getExpressionText() + "[" + Template.TEMPLATE + ".x]";
				final EmbeddableMappingType embeddableMappingType = aggregateJdbcType.getEmbeddableMappingType();
				final int jdbcValueCount = embeddableMappingType.getJdbcValueCount();
				returnType = new SelectableMapping[jdbcValueCount + (indexMapping == null ? 0 : 1)];
				for ( int i = 0; i < jdbcValueCount; i++ ) {
					final SelectableMapping selectableMapping = embeddableMappingType.getJdbcValueSelectable( i );
					// The array expression has to be replaced with the actual array_get read expression in this emulation
					final String customReadExpression = selectableMapping.getCustomReadExpression()
							.replace( Template.TEMPLATE, elementReadExpression );
					returnType[i] = new SelectableMappingImpl(
							selectableMapping.getContainingTableExpression(),
							selectableMapping.getSelectablePath().getSelectableName(),
							new SelectablePath( selectableMapping.getSelectablePath().getSelectableName() ),
							customReadExpression,
							selectableMapping.getCustomWriteExpression(),

View on GitHub (pinned to fad1729dce)

Solutions

  1. Pass a column reference to unnest() instead of an aggregate expression.

When it happens

Trigger: 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..

Common situations: 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..


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/96fec7a182bb5ca3. Report an issue: GitHub.