Multiple Crimes

mysql> select "a" = "A";
+-----------+
| "a" = "A" |
+-----------+
|         1 |
+-----------+
1 row in set (0.00 sec)

WTF? (via Nuxeo)

5 thoughts on “Multiple Crimes

  1. This is true in almost all of the SQL databases that I know, and I would actually have it no other way for the default.  Most of the time, you don’t care about case sensitivity.  All the other times, you can use binary, or change the collation of the table to turn off the insensitiveness.

  2. Huch almost all databases?

    postgres=> select ‘a’ = ‘A’;
    ?column?
    ———-
    f
    (1 row)

    sqlite> select ‘a’ = ‘A’;
    0

    That’s after fixing the double-quotes that are not allowed by standard SQL

  3. also oracle:

    SQL> select case when (‘a’=’A’)  then 1 else 0 end from dual ;

    CASEWHEN(‘A’=’A’)THEN1ELSE0END
    ——————————
      0

    SQL> select case when (‘a’=’a’)  then 1 else 0 end from dual ;

    CASEWHEN(‘A’=’A’)THEN1ELSE0END
    ——————————
      1

  4. > This is true in almost all of the SQL databases that I know, and I would actually have it no other way for the default.

    ha

    psql=> select ‘a’ = ‘A’;
    ?column?
    ———-
    f
    (1 row)

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.