[Bug] use uuid instead of id as primary key error #189

Closed
opened 2024-04-04 15:19:57 +00:00 by C0d9Hunter · 3 comments
C0d9Hunter commented 2024-04-04 15:19:57 +00:00 (Migrated from github.com)

I'm working on a laravel v10 project, filament v3. My producer model defined as such:

  • uuid
  • name,
  • etc...

when I try to export I get this error on the image

filament export error

error in English: SQLSTATE[42883]: Undefined function: 7 ERROR: operator doesn't exist: text = integer LINE 1: select * from "posts" where "posts". "uuid" in (0) order by "... ^ HINT: No operator matches the given name and argument types.

I'm working on a laravel v10 project, filament v3. My `producer model` defined as such: - uuid - name, - etc... when I try to export I get this error on the image ![filament export error](https://github.com/pxlrbt/filament-excel/assets/33271742/18ca22d7-e35b-49b8-9bed-6c6ba1416ce1) error in English: SQLSTATE[42883]: Undefined function: 7 ERROR: operator doesn't exist: text = integer LINE 1: select * from "posts" where "posts". "uuid" in (0) order by "... ^ HINT: No operator matches the given name and argument types.
pxlrbt commented 2024-04-04 16:29:55 +00:00 (Migrated from github.com)

I don't really see the issue here. You say "Producer Model" but this is an error for "posts"? If your Model has a uuid column, then the query would be correct, right?

I don't really see the issue here. You say "Producer Model" but this is an error for "posts"? If your Model has a `uuid` column, then the query would be correct, right?
C0d9Hunter commented 2024-04-05 08:34:06 +00:00 (Migrated from github.com)

Sorry, on my project it's the Model Producer, I got the error on this project and thought I must have made a mistake, so I quickly created another laravel project with the Model Post.

Observation: when the primary key is ID the export goes fine, but when I change it to a uuid I get this error. It's as if the request expects to receive an integer (Id), but a string (UUID) is passed.

Sorry, on my project it's the Model Producer, I got the error on this project and thought I must have made a mistake, so I quickly created another laravel project with the Model Post. Observation: when the primary key is ID the export goes fine, but when I change it to a uuid I get this error. It's as if the request expects to receive an integer (Id), but a string (UUID) is passed.
pxlrbt commented 2026-08-15 11:07:30 +00:00 (Migrated from github.com)

Looks like you didn't declare $keyType = 'string' on your model? 🤔

Looks like you didn't declare `$keyType = 'string'` on your model? 🤔
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pxlrbt/filament-excel#189
No description provided.