SQL error on table bulk action when originally sorting by relationship count

Hello, when using sorting by relationship count:

Tables\Columns\TextColumn::make('people_count')->counts('people')->label('People')->sortable(),

and then executing a table BulkAction, the SQL that Filament executes to get the records to work with is the following (example of me selecting 3 companies from the table):

select * from companies where companies.id in (53, 80, 1, 12) order by people_count desc

This query is not valid, as there is not column "people_count".
Was this page helpful?