Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
12.0.2
-
Ubuntu 24.04
-
Unexpected results
Description
Hi,
Based on the document https://mariadb.com/docs/server/reference/sql-functions/string-functions/locate, if any argument of LOCATE is NULL, LOCATE returns NULL.
However, it returns 0 in the following test case:
CREATE TABLE t0(c0 REAL); |
CREATE TABLE IF NOT EXISTS t1 LIKE t0; |
INSERT INTO t0 VALUES (-1); |
SELECT t1.c0, LOCATE(t0.c0, t0.c0, t1.c0) FROM t0 LEFT JOIN t1 ON false; |
c0 LOCATE(t0.c0, t0.c0, t1.c0)
|
NULL 0
|
I tried this in MySQL and found it returns NULL.