Pgsql error: You might need to add explicit type casts

前端 未结 2 583
鱼传尺愫
鱼传尺愫 2021-02-12 18:04

My website is just working fine til i deployed it to heroku and the problem is heroku uses pgsql and I\'m using mysql and laravel framework.

my query is



        
2条回答
  •  灰色年华
    2021-02-12 18:16

    The problem is here:

    $q->where('vaccine_id','ILIKE','%' . $vaccine_id)
    

    looks like vaccine_id is integer, and you can not use operator ILIKE to integer. Try just '='

    If you want to use LIKE, ILIKE or other text operator you must cast your data to text. In SQL it must looks like:

    WHERE "vaccine_id"::text ILIKE val
    

    instead

    WHERE "vaccine_id" ILIKE val
    

提交回复
热议问题