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 69aee62231
commit 38ad704ea2
No known key found for this signature in database
GPG Key ID: D1D0C3030AE3AA35

View File

@ -1930,8 +1930,11 @@ private boolean isInSubquery() {
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;
} }
/** /**
@ -5571,11 +5574,14 @@ protected void inlineCteTableGroup(TableGroup tableGroup, LockMode lockMode) {
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();
} }