You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Comparison of row constructor and subquery not yet supported #3308
- Version or commit-id (e.g. v0.1.0 or 8b23a93):0.5.0
- Hardware parameters:
- OS type:
- Others:
Actual Behavior
[ERROR]
[SCRIPT FILE]: cases/subquery/subquery-with-any.sql
[ROW NUMBER]: 70
[SQL STATEMENT]: SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a FROM t1 WHERE b = 2);
[EXPECT RESULT]:
Operand should contain 1 column(s)
[ACTUAL RESULT]:
row constructor in ANY subquery not yet supported
[ERROR]
[SCRIPT FILE]: cases/subquery/subquery-with-any.sql
[ROW NUMBER]: 78
[SQL STATEMENT]: SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a FROM t1 WHERE b = 2);
[EXPECT RESULT]:
Operand should contain 2 column(s)
[ACTUAL RESULT]:
row constructor in ANY subquery not yet supported
[ERROR]
[SCRIPT FILE]: cases/subquery/subquery-with-any.sql
[ROW NUMBER]: 84
[SQL STATEMENT]: SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a FROM t1 WHERE b = 2);
[EXPECT RESULT]:
Operand should contain 2 column(s)
[ACTUAL RESULT]:
row constructor in ANY subquery not yet supported
changed the title [-][Bug]: row constructor in ANY subquery not yet supported[/-][+][Bug]: Comparison of row constructor and subquery not yet supported[/+]on Jul 3, 2022
mysql>
mysql> SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a FROM t1 WHERE b = 2);
ERROR 20301 (HY000): invalid input: subquery should return 2 columns
mysql> SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a FROM t1 WHERE b = 2);
ERROR 20301 (HY000): invalid input: subquery should return 2 columns
mysql> SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a FROM t1 WHERE b = 2);
ERROR 20301 (HY000): invalid input: subquery should return 2 columns
Activity
aunjgr commentedon Jun 24, 2022
The row constructor version of ANY/SOME/ALL subquery accept only comparison operators. Row comparisons respect lexicographic order.
https://www.postgresql.org/docs/current/functions-comparisons.html#ROW-WISE-COMPARISON
https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html
domingozhang commentedon Jul 1, 2022
same as #3309 , will be fixed in 0.6.0
[-][Bug]: row constructor in ANY subquery not yet supported[/-][+][Bug]: Comparison of row constructor and subquery not yet supported[/+]Triage matrixorigin#3309 to matrixorigin#3308 and matrixorigin#3312
Triage #3309 to #3308 and #3312 (#3682)
aunjgr commentedon Jul 21, 2022
conversion rules:
(a1, a2, a3) = (b1, b2, b3)->a1 = b1 and a2 = b2 and a3 = b3(a1, a2, a3) <> (b1, b2, b3)->a1 <> b1 or a2 <> b2 or a3 <> b3(a1, a2, a3) < (b1, b2, b3)->a1 < b1 or (a1 = b1 and (a2 < b2 or (a2 = b2 and a3 < b3)))(a1, a2, a3) <= (b1, b2, b3)->a1 < b1 or (a1 = b1 and (a2 < b2 or (a2 = b2 and a3 <= b3)))(a1, a2, a3) > (b1, b2, b3)->a1 > b1 or (a1 = b1 and (a2 > b2 or (a2 = b2 and a3 > b3)))(a1, a2, a3) >= (b1, b2, b3)->a1 > b1 or (a1 = b1 and (a2 > b2 or (a2 = b2 and a3 >= b3)))aunjgr commentedon Jul 21, 2022
All 3308 tags has been removed or retagged to other issues.
aressu1985 commentedon Oct 24, 2022
mysql> DROP TABLE IF EXISTS t1;
Query OK, 0 rows affected (0.01 sec)
mysql> DROP TABLE IF EXISTS t2;
Query OK, 0 rows affected (0.00 sec)
mysql> DROP TABLE IF EXISTS t3;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE TABLE t1 ( a int, b int );
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
Query OK, 3 rows affected (0.00 sec)
mysql>
mysql> SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a FROM t1 WHERE b = 2);
ERROR 20301 (HY000): invalid input: subquery should return 2 columns
mysql> SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a FROM t1 WHERE b = 2);
ERROR 20301 (HY000): invalid input: subquery should return 2 columns
mysql> SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a FROM t1 WHERE b = 2);
ERROR 20301 (HY000): invalid input: subquery should return 2 columns
Triage matrixorigin#3309 to matrixorigin#3308 and matrixorigin#3312 (m…