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
postgresdatabaseSteps to reproduce the behavior
yarn create strapi-app my-project --quickstartpostgresyarn developUserexampleDocuments6. 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
idfield 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=0Console throws an error
Expected behavior
No error, should be able to find model by
idCode snippets
This can be fixed by extending
postgresand addinglower(integer)function definition to database by adding the following code toconfig/functions/bootstrap.jsSystem
Additional context
Error is because you cannot run
lowerfunction on non-text fields inpostgresquery. 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 inpostgresThe text was updated successfully, but these errors were encountered: