Skip to content

[Bug]: Comparison of row constructor and subquery not yet supported #3308

Closed

Description

@aressu1985

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Environment

- 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

Expected Behavior

No response

Steps to Reproduce

No response

Additional information

No response

Activity

  1. added
    kind/bug
    bvt
    on Jun 23, 2022
  2. added this to the v0.5.0 milestone on Jun 23, 2022
  3. modified the milestones: v0.5.0, v0.6.0 on Jun 24, 2022
  4. domingozhang commented on Jul 1, 2022

    @domingozhang
    Contributor

    same as #3309 , will be fixed in 0.6.0

  5. 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
  6. added a commit that references this issue on Jul 3, 2022
  7. added
    severity/s1
    on Jul 17, 2022
  8. aunjgr commented on Jul 21, 2022

    @aunjgr
    Contributor

    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)))
  9. aunjgr commented on Jul 21, 2022

    @aunjgr
    Contributor

    All 3308 tags has been removed or retagged to other issues.

  10. assigned and unassigned on Jul 21, 2022
  11. aressu1985 commented on Oct 24, 2022

    @aressu1985
    ContributorAuthor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bvtkind/bugseverity/s1triage/accepted

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions