Repository navigation
Description
Overview
Based on comprehensive testing against MySQL 8.0 Reference Manual (Section 11.5 Expressions), MatrixOne v3.0 has excellent compatibility (96.2%) with MySQL 8.0 expression syntax. However, 2 expression features are currently not supported.
Environment
- MatrixOne Version: 8.0.30-MatrixOne-v3.0:5e4210029
- Reference: https://dev.mysql.com/doc/refman/8.0/en/expressions.html
Feature 1: SOUNDS LIKE Predicate
Description
The SOUNDS LIKE predicate is used for phonetic (Soundex algorithm) similarity matching between strings. This is commonly used for name matching scenarios where similar-sounding names should match.
Current Behavior
SELECT 'hello' SOUNDS LIKE 'halo';Error:
ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax;
check the manual that corresponds to your MatrixOne server version for the
right syntax to use. syntax error at line 1 column 26 near " LIKE 'halo'"
Expected Behavior (MySQL 8.0)
SELECT 'hello' SOUNDS LIKE 'halo';Result:
+----------------------------+
| 'hello' SOUNDS LIKE 'halo' |
+----------------------------+
| 1 |
+----------------------------+
Workaround
-- Use REGEXP for pattern matching
SELECT 'hello' REGEXP '^h.*o';
-- Or implement Soundex algorithm in application layerImpact Assessment
- Severity: Low
- Usage: Phonetic matching (name matching, fuzzy search)
- Alternative: Available via REGEXP or application-layer implementation
Feature 2: ROW Constructor Expression
Description
The ROW constructor creates row values that can be compared. This is useful for multi-column comparisons and tuple comparisons in SQL queries.
Current Behavior
SELECT ROW(1, 2) = ROW(1, 2);Error:
ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax;
check the manual that corresponds to your MatrixOne server version for the
right syntax to use. syntax error at line 1 column 10 near " ROW(1, 2) = ROW(1, 2)"
Expected Behavior (MySQL 8.0)
SELECT ROW(1, 2) = ROW(1, 2);Result:
+--------------------------+
| ROW(1, 2) = ROW(1, 2) |
+--------------------------+
| 1 |
+--------------------------+
Common Use Cases
1. Multi-column comparison in subqueries
-- MySQL syntax
SELECT * FROM t1 WHERE (c1, c2) = (SELECT c1, c2 FROM t2 WHERE id = 1);2. Row value IN queries
-- MySQL syntax
SELECT * FROM t1 WHERE (c1, c2) IN (SELECT c1, c2 FROM t2);3. Composite ordering comparisons
-- MySQL syntax
SELECT * FROM users WHERE (last_name, first_name) > ('Smith', 'John');Workarounds
For multi-column comparison:
-- Rewrite using AND
SELECT * FROM t1
WHERE c1 = (SELECT c1 FROM t2 WHERE id = 1)
AND c2 = (SELECT c2 FROM t2 WHERE id = 1);
-- Or use JOIN
SELECT t1.* FROM t1
JOIN t2 ON t1.c1 = t2.c1 AND t1.c2 = t2.c2
WHERE t2.id = 1;For row value IN queries:
-- Rewrite using JOIN
SELECT DISTINCT t1.* FROM t1
JOIN t2 ON t1.c1 = t2.c1 AND t1.c2 = t2.c2;For composite ordering:
-- Rewrite using compound conditions
SELECT * FROM users
WHERE last_name > 'Smith'
OR (last_name = 'Smith' AND first_name > 'John');Impact Assessment
- Severity: Medium
- Usage: Multi-column comparisons, complex queries from ORM frameworks
- Alternative: Available but requires verbose query rewrites
Summary
| Feature | Priority | Workaround Available | Common Usage |
|---|---|---|---|
| SOUNDS LIKE | Low | Yes (REGEXP) | Phonetic matching |
| ROW constructor | Medium | Yes (AND/JOIN) | Multi-column comparison |
Recommendation
While both features have workarounds, supporting them would:
- Improve MySQL 8.0 compatibility to 98%+
- Reduce migration effort from MySQL applications
- Support ORM frameworks that generate such SQL
The ROW constructor is recommended as higher priority due to its more common usage in complex SQL queries and ORM-generated statements.
Activity
feat(sql): support MySQL SOUNDS LIKE predicate (#31373)