Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5078

Incorrect 'Subquery returns more than 1 row'

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.4, 5.3.12, 5.5.33a
    • Fix Version/s: 5.5.34, 10.0.6, 5.3.13
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows Vista, 32 bit

      Description

      Subquery in result column complains about returning multiple rows even though an aggregation is done over the rows.

      CREATE TABLE t1 (
        a INT(11)
      );
       
      INSERT INTO t1 (a) VALUES (1), (2);
       
      CREATE TABLE t2 (
        b INT(11)
      );
       
      INSERT INTO t2 (b) VALUES (1), (2);
       
      SELECT
        a,
        (
          SELECT
            SUM(a + c) 
          FROM
            (
              SELECT
                b as c
              FROM
                t2
            ) AS v1 
        )
      FROM
        t1;

      Result:

      ERROR 1242 (21000): Subquery returns more than 1 row

      Expected

      a   subquery
      1   5
      2   7

        Attachments

          Activity

            People

            • Assignee:
              igor Igor Babaev
              Reporter:
              gvdent Gijs van der Ent (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: