Skip to content

Conversation

@ismaildasci
Copy link

Summary

This PR fixes a bug where applySortingToTableQuery() was being called twice when executing bulk actions, causing SQL errors on SQL Server.

The Problem

When executing a bulk action, the applySortingToTableQuery() method was called twice on the same query object:

  1. First in getSelectedTableRecordsQuery() at line 273
  2. Then again in getSelectedTableRecords() at line 235

This resulted in duplicate ORDER BY clauses, which causes SQL Server (and likely other databases that enforce unique columns in ORDER BY) to throw an error:

SQLSTATE[42000]: A column has been specified more than once in the order by list.
Columns in the order by list must be unique.

The Fix

Remove the redundant applySortingToTableQuery() call from getSelectedTableRecords() since it's already being called within getSelectedTableRecordsQuery().

Fixes #18991

Test plan

  • Verified the duplicate call is removed
  • Test bulk actions on SQL Server with sorted columns
  • Test bulk actions on other databases to ensure no regression

🤖 Generated with Claude Code

The applySortingToTableQuery() method was being called twice when executing
bulk actions - once in getSelectedTableRecordsQuery() at line 273 and again
in getSelectedTableRecords() at line 235. This caused SQL errors on SQL Server
(and other databases that enforce unique columns in ORDER BY) due to duplicate
ORDER BY clauses.

Fixes filamentphp#18991
@ismaildasci ismaildasci force-pushed the fix/duplicate-sorting-bulk-actions branch from 8adae0e to d3ac13c Compare January 17, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant