SelectFIlter & AsEnumCollection
I have a model
Caliber
.
It has a casts
like this:
I then have a SelectFilter
on the table like so:
The table works/looks fine: (see attached image)
But when I try to filter the table, I get an SQL error. Using PostgreSQL 14.
Since the column is a jsonb I can see why it doesn't like this.
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type json DETAIL: Token "pistol" is invalid. CONTEXT: JSON data, line 1: pistol unnamed portal parameter $1 = '...'
I could convert to using a 'caliber_types' table but given these types should never really change, it seems like overkill.
Any thoughts?
Posting this and stepping away for dinner real fast. Will check in as soon as I get back.10 Replies
But Postgres is so good. Lol. Jk.
I switched out to sqlite and it doesn't throw an 'error' anymore, but the search results are wrong / it 'ignores' the filter
Weird.
The db matters. As much as I hate it.
Had this happen today where a script drops foreign key constraints for a migration, but the syntax is relevant for sqlite vs MySQL. So frustrating.
This is using sqlite
Yea. I was trying to port MySQL to sqlite but sqlite doesn’t know ‘set’
lol.
At least as a function with the DB facade.
Was trying to find if this is a eloquent problem, a laravel problem, or a filament problem lol
It could be a 'me' problem too but I don't believe so..
Definitely a db problem.
DB::statement('SET FOREIGN_KEY_CHECKS=0;'); definitely throws an error with sqlite. Lol.