-
-
Notifications
You must be signed in to change notification settings - Fork 254
Fix weird postgres behavior when selecting mounts #1842
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
Conversation
📝 WalkthroughWalkthroughReplaced the eggs relationship Select in MountResource.php with a three-argument call that provides a query callback selecting only Changes
Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Yes, that fixed the issue. I couldn't find any more issues with postgres and mounts, all CRUD operations seem to work |
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/Filament/Admin/Resources/Mounts/MountResource.php (1)
165-166: Fix correctly addresses the PostgreSQL DISTINCT issue.The query callback restricting selection to only
idandnameprevents PostgreSQL from attempting DISTINCT operations on JSON columns, which resolves the reported SQL error. This is the minimal change needed since Filament's Select component only requires these two fields.Optional: Consider using "PostgreSQL" instead of "Postgres" in the comment.
For consistency with the formal product name, consider this minor wording update:
- // Selecting only non-json fields to prevent Postgres from choking on DISTINCT JSON columns + // Selecting only non-json fields to prevent PostgreSQL from choking on DISTINCT JSON columns
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/Filament/Admin/Resources/Mounts/MountResource.php(1 hunks)
🔇 Additional comments (1)
app/Filament/Admin/Resources/Mounts/MountResource.php (1)
170-170: No changes needed for the nodes relationship.The
nodestable contains only scalar column types (integers, strings, timestamps) with no JSON/JSONB columns. The PostgreSQL DISTINCT issue that affected theeggsrelationship does not apply here. Thenodesrelationship at line 170 is correctly implemented.

Basically I use Pelican with Postgres (I know it's not recommended, but still) and on New Mount page in admin area I get following error:
I'm not sure if this the correct solution, but I opted for selecting only distinct id and name to prevent Postgres from comparing JSON columns