Bug #43966 | Canonical query does not treat \N as NULL | ||
---|---|---|---|
Submitted: | 30 Mar 2009 17:26 | Modified: | 22 May 2017 8:11 |
Reporter: | Diego Medina | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Enterprise Monitor: Agent | Severity: | S3 (Non-critical) |
Version: | 2.1.0.1019 | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[30 Mar 2009 17:26]
Diego Medina
[30 Mar 2009 17:29]
Diego Medina
=== modified file 'tests/unit/lua/quan.lua' --- tests/unit/lua/quan.lua 2009-03-04 19:00:08 +0000 +++ tests/unit/lua/quan.lua 2009-03-30 17:27:33 +0000 @@ -141,3 +141,48 @@ com_query_normalize("/*! */SELECT 1", "/*! */ SELECT ? ", "", "SELECT") +--[[ +Bug #43965 - Canonical query does not replace NULL for literal ? + +Special case for NULL as literal or keyword + +--]] +com_query_normalize("SELECT NULL", + "SELECT ? ", "", "SELECT") +com_query_normalize("SELECT -NULL", + "SELECT ? ", "", "SELECT") +com_query_normalize("SELECT - NULL", + "SELECT ? ", "", "SELECT") +com_query_normalize("SELECT foo FROM tbl WHERE fld IN ( NULL , 1 )", + "SELECT foo FROM tbl WHERE bar IN ( ? /* , ... */ ) ", "", "SELECT") +com_query_normalize("INSERT INTO tbl VALUES (NULL, 1)", + "INSERT INTO tbl VALUES( ? ) ", "", "INSERT") +com_query_normalize("INSERT INTO tbl VALUES ( NULL ), ( 1 )", + "INSERT INTO tbl VALUES( ? /* , ... */ ) ", "", "INSERT") +com_query_normalize("SELECT 1 IS NULL", + "SELECT ? IS NULL", "", "SELECT") +com_query_normalize("SELECT 1 IS NOT NULL", + "SELECT ? IS NOT NULL", "", "SELECT") + +--[[ +Bug #43966 + +Special case for \N == NULL + +--]] +com_query_normalize("SELECT \N", + "SELECT ? ", "", "SELECT") +com_query_normalize("SELECT -\N", + "SELECT ? ", "", "SELECT") +com_query_normalize("SELECT - \N", + "SELECT ? ", "", "SELECT") +com_query_normalize("SELECT foo FROM tbl WHERE fld IN ( \N , 1 )", + "SELECT foo FROM tbl WHERE bar IN ( ? /* , ... */ ) ", "", "SELECT") +com_query_normalize("INSERT INTO tbl VALUES (\N, 1)", + "INSERT INTO tbl VALUES( ? ) ", "", "INSERT") +com_query_normalize("INSERT INTO tbl VALUES ( \N ), ( 1 )", + "INSERT INTO tbl VALUES( ? /* , ... */ ) ", "", "INSERT") +com_query_normalize("SELECT 1 IS \N", + "SELECT ? IS NULL", "", "SELECT") +com_query_normalize("SELECT 1 IS NOT \N", + "SELECT ? IS NOT NULL", "", "SELECT")