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

Fix problem with unprefixed group by columns in select queries #21370

Merged
merged 2 commits into from
Oct 10, 2023
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Oct 5, 2023

Description:

When complex queries are built it can happen that some columns exists in more than one table.
The method to build the query had a bug, where the column names used in the order by were not prefixed in all cases.

I was able to reproduce the problem when setting [General] enable_segments_cache = 0 in the config.
And triggering the archiving for e.g. DevicesDetection while using a segment like browserCode==FF.

The archiving for DevicesDetection will trigger an aggregation for conversion and so creates a query that joins log_visit and log_conversion. Both tables share a couple of dimensions. When it e.g. queries for config_browser_name, this fails if the column is not prefixed in order by.

Note: While moving around the code I was wondering about the special handling of referrer_data. Seems there actually is no reason for that special handling, as the way the query is built in transitions plugin could be easily changed to avoid any special handling at all.

fixes #21351

Review

@sgiehl sgiehl added this to the 5.0.0 milestone Oct 5, 2023
@sgiehl sgiehl marked this pull request as ready for review October 6, 2023 13:12
@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Oct 6, 2023
@sgiehl sgiehl requested a review from a team October 6, 2023 13:12
@caddoo caddoo assigned caddoo and unassigned caddoo Oct 8, 2023
@mneudert mneudert self-assigned this Oct 10, 2023
@mneudert mneudert changed the title Fix problem with unprefixed order by columns in select queries Fix problem with unprefixed group by columns in select queries Oct 10, 2023
@mneudert mneudert merged commit 66bd55a into 5.x-dev Oct 10, 2023
@mneudert mneudert deleted the m21351 branch October 10, 2023 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Matomo 5 Archiving regression: Column 'config_browser_name' in group statement is ambiguous
3 participants