Skip to content

fix: improve column alias detection #3236

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

Merged
merged 1 commit into from
May 8, 2025
Merged

Conversation

Seb33300
Copy link
Contributor

@Seb33300 Seb33300 commented May 8, 2025

Fixes #3235

This PR improves detection of column aliases.

Before, it could detect only if the alias has exactly 1 space between as and alias name.
Now it supports (I hope) all cases:

DB::raw('table.column as   alias'); // multiple spaces
DB::raw('table.column as `alias`'); // escaped (wrapped) aliases
DB::raw('table.column as alias, table.column2 as alias2'); // multiple aliases in 1 definition
// multiple lines
DB::raw('table.column as  
alias');

Copy link

sonarqubecloud bot commented May 8, 2025

@yajra yajra merged commit 227e0ee into yajra:master May 8, 2025
6 of 7 checks passed
@yajra
Copy link
Owner

yajra commented May 8, 2025

@Seb33300 Seb33300 deleted the fix-column-alias branch May 8, 2025 07:59
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.

Column not found for version 12.1.1 and 12.1.2
2 participants