HHH-17769 Ignore query options limit when rendering cte definitions

This commit is contained in:
Marco Belladelli 2024-02-27 11:58:41 +01:00
parent e80329f962
commit 841e4bedc7
1 changed files with 6 additions and 0 deletions

View File

@ -2445,8 +2445,11 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
protected void visitCteDefinition(CteStatement cte) { protected void visitCteDefinition(CteStatement cte) {
final CteStatement oldCteStatement = currentCteStatement; final CteStatement oldCteStatement = currentCteStatement;
currentCteStatement = cte; currentCteStatement = cte;
final Limit oldLimit = limit;
limit = null;
cte.getCteDefinition().accept( this ); cte.getCteDefinition().accept( this );
currentCteStatement = oldCteStatement; currentCteStatement = oldCteStatement;
limit = oldLimit;
} }
/** /**
@ -6211,11 +6214,14 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
true, true,
null null
); );
final Limit oldLimit = limit;
limit = null;
statementStack.push( cteDefinition ); statementStack.push( cteDefinition );
renderPrimaryTableReference( queryPartTableGroup, lockMode ); renderPrimaryTableReference( queryPartTableGroup, lockMode );
if ( queryPartTableGroup.isLateral() && !dialect.supportsLateral() ) { if ( queryPartTableGroup.isLateral() && !dialect.supportsLateral() ) {
addAdditionalWherePredicate( determineLateralEmulationPredicate( queryPartTableGroup ) ); addAdditionalWherePredicate( determineLateralEmulationPredicate( queryPartTableGroup ) );
} }
limit = oldLimit;
statementStack.pop(); statementStack.pop();
} }