Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queryScalar - check subquery before changing params #15223

Merged
merged 3 commits into from
Jun 18, 2024

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Jun 18, 2024

Description

When running a query through our version of queryScalar, check if the subquery doesn’t have distinct, groupBy, having or union and only overwrite its select, orderBy, limit, and offset params if it doesn’t.

Related issues

#15001

@i-just i-just requested a review from brandonkelly June 18, 2024 15:01
@brandonkelly brandonkelly changed the base branch from 5.x to 4.x June 18, 2024 16:20
@brandonkelly brandonkelly merged commit 5e0dbea into 4.x Jun 18, 2024
8 checks passed
@brandonkelly brandonkelly deleted the bugfix/15001-subquery-checks branch June 18, 2024 18:02
@samhibberd
Copy link

@brandonkelly does this also impact the exists() query method, since upgrading to 4.10.x which introduced this logic to work off the subquery:

try {
return $this->prepareSubquery()
->select('elements.id')
->exists($db);
} catch (QueryAbortedException) {
return false;
}

We are running into the same issue with the exists method when a HAVING clause is used (for us with simplemap ethercreative/simplemap#391 (comment))

@brandonkelly
Copy link
Member

@samhibberd Craft 4.10.8 and 5.2.10 are out with a fix for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants