Skip to content

fix: prevent ambiguous column names #3227

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Seb33300
Copy link
Contributor

When using complex queries with joins, I am often facing ambiguous column name errors when sorting a column of the base table sharing the same name as a column of a relation table field (eg: created_at)

Until now, the workaround I used was to rename my columns

// From
DateColumn::make('created_at')`
// To
DateColumn::make('created_at', 'table.created_at')

But it's probably better to fix the root cause by forcing the table name if the column is not a relation.

And it's consistent with $this->joinEagerLoadedColumn() which is returning columns name with alias.

@Seb33300 Seb33300 marked this pull request as draft April 22, 2025 03:30
@Seb33300 Seb33300 marked this pull request as ready for review April 22, 2025 03:55
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.

1 participant