Log1x/filament-starter

Undefined function error "operator does not exist: text ->> unknown" with PostgreSQL

Closed this issue · 3 comments

I'm a noob trying out the starter and followed the install instructions, except changed the DB_CONNECTION=pgsql in the .env file. The migrations and seeds ran without a hitch. However, when I navigate anywhere in the admin panel I get a query exception:

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: text ->> unknown LINE 1: ...ifications"."notifiable_id" is not null and "data"->>'format... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
select * from "notifications" where "notifications"."notifiable_type" = App\Models\User and "notifications"."notifiable_id" = 1 and "notifications"."notifiable_id" is not null and "data"->>'format' = filament order by "created_at" desc limit 51 offset 0

I've poked around a bit but not sure where to start troubleshooting this. Seems clearly to have to do with using PostgreSQL, but I'm looking for some expert guidance on how to go about fixing this. Any help?

Hey!

Looking at https://filamentphp.com/docs/3.x/notifications/database-notifications – it looks like you need to change the notifications migration to use $table->json('data') and then re-run the migrations/seeder.

Outside of that, I don't personally have any experience using Postgres with Filament.

Screenshot

Excellent. Changing the notifications table migration as instructed there did the trick. Thank you!

Glad it worked!