fix: qualify the index list's search columns - #26
Conversation
The Indexes list joins pg_class onto pg_stat_user_indexes, and both of them have a relname. The search columns were unqualified, so the predicate Filament built named a column PostgreSQL could not resolve, and every search on that page ended in SQLSTATE[42702] rather than a result. Qualifying both with the model's table is enough -- Filament passes a column already prefixed with it through untouched -- and it keeps the column's two searches, by index name and by the table the index belongs to, working as they read. Fixes Heyosseus#25 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The six red legs here are not this change: they all fail at The three green legs (PG 14/15/16) are the SQL-only ones; the full gate never gets past PHPStan to the tests on the others. Locally, with that step aside: |
|
Thank you for the quick merge and the release — one snag, though: v1.2.1 does not contain this change. The tag points at A v1.2.2 off current No rush from my side: we are holding our bump until it is out rather than shipping 1.2.1, since its only change is contributor-facing. |
|
Sorry, my bad. Check out v1.2.2 release. Thanks for the contribution. |
Fixes #25.
Searching the Indexes list threw
SQLSTATE[42702]: column reference "relname" is ambiguousand took the whole page down with it.getEloquentQuery()joinspg_class, which has arelnameof its own, while the column's search columns were unqualified:Filament leaves a search column alone unless it is already prefixed with the model's table, so what reached PostgreSQL was
lower("relname"::text) like $1with two candidate relations in scope.indexrelnameexists in only one of them, which is why the error named just the one column.Qualifying both is enough, and reads the way the rest of the resource already selects its columns:
The regression test drives the column's own search constraint against real SQL rather than a rendered page, so it fails with the
QueryExceptiononmainand covers both searches the column offers — by index name, and by the table the index belongs to.Verified
composer test:lintandcomposer test:refactopass.tests/Filament/IndexResourceTest.phppasses in full (5 tests, 21 assertions); the new test fails withSQLSTATE[42702]without the one-line change.pg_stat_statementspreloaded (no Docker on this machine), so the Statements, Learn and History tests fail there onSQLSTATE[55000] ... must be loaded via shared_preload_libraries, before and after this change alike.composer test:typesreports 10 pre-existingview-stringerrors undersrc/Http/Controllers, untouched by this change — CI will be the judge of both.🤖 Generated with Claude Code