Case Insensitive searches/queries

橙三吉。 提交于 2019-12-01 05:21:56

Use ILIKE, e.g.:

...
WHERE 
    address ILIKE '123 main st%'

Documentation.


Alternatively you could use UPPER or LOWER, e.g.:

...
WHERE 
    LOWER(address) LIKE '123 main st%'

Apart from ILIKE and the lower() approach, I can see two other possibilities:

  1. Use the citext data type: http://www.postgresql.org/docs/9.0/static/citext.html.
  2. Use the full text search - which might actually be the most flexible and fastest solution, although a bit more complicated to get started with.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!