Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
Implement MEMBER OF operator for MySQL compatibility.
Used as
mysql> SELECT 17 MEMBER OF('[23, "abc", 17, "ab", 10]'); |
+-------------------------------------------+ |
| 17 MEMBER OF('[23, "abc", 17, "ab", 10]') | |
+-------------------------------------------+ |
| 1 |
|
+-------------------------------------------+ |
 |
mysql> SELECT "17" MEMBER OF('[23, "abc", 17, "ab", 10]'); |
+---------------------------------------------+ |
| "17" MEMBER OF('[23, "abc", 17, "ab", 10]') | |
+---------------------------------------------+ |
| 0 |
|
+---------------------------------------------+ |
Can probably be implemented as
SELECT JSON_CONTAINS(arg1, JSON_QUOTE(arg2)); |
but JSON_QUOTE needs to be extended to convert non-string arguments. Now it's
MariaDB [test]> select json_quote(17), json_quote('17'), json_quote(null); |
+----------------+------------------+------------------+ |
| json_quote(17) | json_quote('17') | json_quote(null) | |
+----------------+------------------+------------------+ |
| NULL | "17" | NULL | |
+----------------+------------------+------------------+ |
1 row in set (0.001 sec) |
must be
MariaDB [test]> select json_quote(17), json_quote('17'), json_quote(null); |
+----------------+------------------+------------------+ |
| json_quote(17) | json_quote('17') | json_quote(null) | |
+----------------+------------------+------------------+ |
| 17 | "17" | null | |
+----------------+------------------+------------------+ |
1 row in set (0.001 sec) |
that is, numbers and null should be converted to json numbers and json null.
Attachments
Issue Links
- is part of
-
MDEV-28906 MySQL 8.0 desired compatibility
-
- Open
-