How do you write a case insensitive query for both MySQL and Postgres?

后端 未结 11 2072
南方客
南方客 2020-11-29 23:39

I\'m running a MySQL database locally for development, but deploying to Heroku which uses Postgres. Heroku handles almost everything, but my case-insensitive Like statements

11条回答
  •  醉梦人生
    2020-11-30 00:03

    select * from foo where upper(bar) = upper(?);
    

    If you set the parameter to upper case in the caller, you can avoid the second function call.

提交回复
热议问题