On 14/12/2012 06:16, Chris Angelico wrote:

Yeah, it's one of the things that tripped me up when I did a
MySQL->PostgreSQL conversion earlier this year. The code was assuming
case insensitivity, and began failing on PG. Fortunately the simple
change of LIKE to ILIKE solved that.

I'd MUCH rather be explicit about wanting case insensitivity.

Just as a side-note, for those who may be interested -

PostgreSQL allows you to create an index using an expression.

Therefore you can say -

  CREATE INDEX ndx ON table_name (LOWER(col_name))

Then you can SELECT ... WHERE LOWER(col_name) = LOWER(%s), and it will use the index, so it is not necessary to coerce the data to lower case before storing.

Frank Millman


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to