【发布时间】:2017-06-28 05:13:57
【问题描述】:
我的网站运行良好,直到我将它部署到 heroku,问题是 heroku 使用 pgsql,而我使用的是 mysql 和 laravel 框架。
我的查询是
$patient = Patient::where('patient_address', 'ILIKE' ,'%' . $request->input)->where('patient_sex', 'ILIKE' ,'%' . $request->gender)->whereHas('users', function($q) use($vaccine_id){
$q->where('vaccine_id','ILIKE','%' . $vaccine_id);
})->get();
这是我将它部署到 heroku 时得到的结果
SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: integer ~~* unknown
LINE 1: ...ient_id" = "patients"."PatientID" and "vaccine_id" ILIKE $3)
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. (SQL: select * from "patients" where "patient_address" ILIKE %San Francisco and "patient_sex" ILIKE % and exists (select * from "vaccines" inner join "immunizations" on "vaccines"."VaccineID" = "immunizations"."vaccine_id" where "immunizations"."patient_id" = "patients"."PatientID" and "vaccine_id" ILIKE %))
我尝试使用像 CAST(vaccine_id AS VARCHAR) 这样的强制转换,但我没有收到错误,但它没有返回任何结果。
【问题讨论】:
-
我不太了解这个 API,但是
where "patient_address" ILIKE %San Francisco是错误的,San Francisco应该用单引号 AFAIK。 -
这是一个变量 $request->input = san fancisco 我如何在上面加上单引号?
-
我不确定,只能告诉你,如果查询输出是逐字的,那就错了。
标签: postgresql heroku