MySQLdb compare lower

Chris Angelico rosuav at gmail.com
Thu Dec 13 23:16:54 EST 2012


On Fri, Dec 14, 2012 at 2:35 PM, Cameron Simpson <cs at zip.com.au> wrote:
> On 13Dec2012 18:39, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> | On Thu, 13 Dec 2012 18:00:48 +1100, Cameron Simpson <cs at zip.com.au>
> | declaimed the following in gmane.comp.python.general:
> | > On 12Dec2012 02:03, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> | > |   According to the old "MySQL Language Reference"
> | > | """
> | > | By default, string comparisons are not case sensitive and will use the
> | > | current character set (ISO-8859-1 Latin1 by default, which also works
> | > | excellently for English).
> | > | """
> | >
> | > I'm flabbergasted. [... consults the internets ...] It is still the case
> | > today:-( Ouch.
> | >
> |       I just checked... The book I referenced was the blue&white published
> | by the late MySQL AB -- and the book claims to cover up to v5.0.1... I
> | thought it was just the end of the 4.x branch (like the old brown
> | O'Reilly/MySQL AB book was middle era of 4.x)
>
> My checking was for MySQL 5.5. Still case insensitive.

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. I wonder
who would go insane first if I ran an app using Wine under Linux in a
directory that's mounted via cifs from a Windows or OS/2 box... (And
yes, I have that setup, ready to go. Only there's an extra level of
indirection - I'd run it in an sshfs mount that points to my proxy
box. Extra safety, keeps messy networking away from my real boxes.)

ChrisA



More information about the Python-list mailing list