Skip to content
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

fix: set primary key as string #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zhanang19
Copy link

@zhanang19 zhanang19 commented Jan 25, 2025

When eager loading relationship using PostgreSQL, like this Outlet::with('district')->first(), the following error occured:

Illuminate\Database\QueryException  SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: character = integer
LINE 1: ...sia_districts" where "indonesia_districts"."code" in (352314...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts. (Connection: pgsql, SQL: select * from "indonesia_districts" where "indonesia_districts"."code" in (352314)).

After configuring the model primary key as string resolve the issue.

Reference: https://laravel.com/docs/11.x/eloquent#primary-keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant