Search Postgresql Archives

Re: Case sensitivity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To handle searching for a row based on a string, I will use "LOWER(colname) = 'x'" and "LOWER(colname) LIKE 'x%'". AFAICT, the second one is equivalent
to "colname ILIKE 'x%'", provided I force 'x' to lowercase first.

I would strongly suggest you do this instead:

  LOWER(colname) = LOWER('x')

This is far more bullet-proof than lower-casing in the client, in case the client and the server differ (mismatched locales, etc.). If you don't want to use ILIKE for portability reasons (perfectly reasonable), I suggest the analogous:

  LOWER(colname) LIKE LOWER('x%')

- John D. Burger
  MITRE



---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux