<p>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 become case sensitive. I could use iLike statements, but my local MySQL database can't handle that.</p>

<p>What is the best way to write a case insensitive query that is compatible with both MySQL and Postgres? Or do I need to write separate Like and iLike statements depending on the DB my app is talking to?</p>

```
```
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.