A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
18.2k
stars
2.84k
forks
source link
Summarize Query Bug on PostgreSQL #9177
Closed
chrisreedio closed 11 months ago
Package
filament/filament
Package Version
v3.0.80
Laravel Version
v10.28.0
Livewire Version
v3.0.10
PHP Version
v8.2.11
Problem description
When using a custom Summarizer on PostgreSQL, I get the following QueryException:
SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier at or near """"
The generated query is:
You can see that the last line of the generated query is
) AS ""
.Possible Solution Identified?
If this pans out, I can submit a PR for this fix.
I looked at https://github.com/filamentphp/filament/blob/62cf9339776b6ba517a510774bfe89feb3bd14fe/packages/tables/src/Columns/Summarizers/Summarizer.php#L108
and
https://github.com/filamentphp/filament/blob/62cf9339776b6ba517a510774bfe89feb3bd14fe/packages/tables/src/Concerns/CanSummarizeRecords.php#L70
When I took the line from
CanSummarizeRecords
and replaced L108 inSummarizer
with it, the problem was resolved.It seems on PostgreSQL we can't have the second argument of that function be null (the default).
Broken - Summarizer.php - L108
Works - CanSummarizeRecords.php - L70
Expected behavior
It would display the proper summary such as this example from another project.
Steps to reproduce
I have a Resource/Model with a quantity and price field/column.
I want to multiply them together for each line in the table to build out the 'total price'.
Reproduction repository
https://github.com/chrisreedio/filament-summarize-delim-bug/blob/main/app/Filament/Resources/InvoiceItemResource.php#L74
Relevant log output
No response