Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Admin Panel. Can't search by ID in relation in with `postgres` database. function lower(integer) does not exist #7854
Comments
Hello! Thank you for reporting this behavior. Something I would greatly appreciate is if you can try to submit a PR to fix this issue. The topic you are pointing out has to be fixed and it could be done by someone from the Community (you Here is the contributing guide to help you to getting started for contributions to Strapi. Do not hesitate to reach us if you have any questions regarding the contribution. Thank you and have a good day. |
@derrickmehaffy I would yet I don't think my solution is fully correct. I'm JavaScript expert not SQL/Postgres at all and this issue does concern more SQL than JavaScript in my option. Other solution I'm thinking is to change |
Describe the bug
Can't search by ID in relation in with
postgres
databaseSteps to reproduce the behavior
yarn create strapi-app my-project --quickstart
postgres
yarn develop
User
exampleDocuments
6. Create at least 2 users in the panel
7. Try to create a new model, in User field when you try to find users by
id
field error occurs and you cannot find thisOnce you start to autocomplete search you get admin error, which is trying to find that model by given type input
calling Admin API with
/content-manager/explorer/application::XXX.XXX?id_contains=23&_limit=20&_start=0
Console throws an error
Expected behavior
No error, should be able to find model by
id
Code snippets
This can be fixed by extending
postgres
and addinglower(integer)
function definition to database by adding the following code toconfig/functions/bootstrap.js
System
Additional context
Error is because you cannot run
lower
function on non-text fields inpostgres
query. They should be cast to text before the query. The framework is trying to the the following queryselect distinct "XXX".* from "XXX" where LOWER("XXX"."id") LIKE LOWER(?) limit ?
(where XXX is your model name) which is invalid inpostgres