Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-6247

Too many "SELECT Group_Id FROM Groups_Users WHERE Login = null"

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.4, 3.5, 3.7.2, 3.8, 3.9, 4.0 alpha
    • None
    • None
    • None

      Too many "SELECT Group_Id FROM Groups_Users WHERE Login = null"

          [CMS-6247] Too many "SELECT Group_Id FROM Groups_Users WHERE Login = null"

          https://dev.mysql.com/doc/refman/5.1/en/problems-with-null.html

          To search for column values that are NULL, you cannot use an expr = NULL test. The following statement returns no rows, because expr = NULL is never true for any expression:

          mysql> SELECT * FROM my_table WHERE phone = NULL;

          To look for NULL values, you must use the IS NULL test. The following statements show how to find the NULL phone number and the empty phone number:

          mysql> SELECT * FROM my_table WHERE phone IS NULL;

          The problem is, when we do a setString("Login", null) the mysql java driver translates it to "where Login = null" instead of "where Login IS NULL".

          Nicolas Gavalda (Inactive) added a comment - https://dev.mysql.com/doc/refman/5.1/en/problems-with-null.html To search for column values that are NULL, you cannot use an expr = NULL test. The following statement returns no rows, because expr = NULL is never true for any expression: mysql> SELECT * FROM my_table WHERE phone = NULL; To look for NULL values, you must use the IS NULL test. The following statements show how to find the NULL phone number and the empty phone number: mysql> SELECT * FROM my_table WHERE phone IS NULL; The problem is, when we do a setString("Login", null) the mysql java driver translates it to "where Login = null" instead of "where Login IS NULL".

          Frederic Ravetier (Inactive) added a comment - Link from nga : https://dev.mysql.com/doc/refman/5.1/en/problems-with-null.html

          To optimize the request it is 10000x better to use LOGIN IS NULL instead of LOGIN = null !

          Frederic Ravetier (Inactive) added a comment - To optimize the request it is 10000x better to use LOGIN IS NULL instead of LOGIN = null !

            raphael Raphaƫl Franchet
            fravetier Frederic Ravetier (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: