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

[10.x] Fixes usage with sqlsrv databases #740

Merged
merged 5 commits into from
May 19, 2023
Merged

Conversation

nunomaduro
Copy link
Member

@nunomaduro nunomaduro commented May 18, 2023

Scout is currently experiencing compatibility issues with Microsoft SQL Server databases, as an error is thrown when attempting to import models on Scout. The error message is as follows:

  SQLSTATE[HY000]: General error: 20018 A column has been specified more than once in the order by list. Columns in the order by list must be unique. [20018] (severity 15) [select top 500 * from [users] order by [users].[id] asc, [id] asc] (Connection: sqlsrv, SQL: select top 500 * from [users] order by [users].[id] asc, [id] asc)

The regression was introduced in the changes made during the pull request at #509. It happens because two "order by" statements are used with the same column name. While this doesn't pose any problems with other database drivers, it causes issues with Microsoft SQL Server databases, as they do not allow multiple "order by" clauses with the same column name.

Fixes #723.

@nunomaduro
Copy link
Member Author

@driesvints @mmachatschek Do you mind of reviewing this pull request, and let me know what do you think?

@nunomaduro nunomaduro marked this pull request as ready for review May 18, 2023 20:48
Copy link
Contributor

@mmachatschek mmachatschek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nunomaduro @driesvints LGTM ✅ 🚀

@taylorotwell taylorotwell merged commit 79b7f99 into 10.x May 19, 2023
@taylorotwell taylorotwell deleted the fix/sqlsrv-column-orders branch May 19, 2023 13:48
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.

Import query duplicates key column in orderBy causing SQL exception
4 participants