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

Row constructors in VALUES cause strange behaviour

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Cannot Reproduce
    • 10.3
    • N/A
    • N/A

    Description

      If VALUES has only 1 row and it contains at least 1 row constructor, nothing is returned:

      MariaDB [test]> VALUES (1, 2, (3, 3));
      Query OK, 0 rows affected (0.000 sec)
      

      If it has multiple rows, rows constructors become a 0-value for the first row, and the value from the previous rows for the following rows:

      MariaDB [test]> VALUES
          ->     ((5,5), 5),
          ->     (1,     2),
          ->     ((6,6), (7,7)),
          ->     ((6,6), (7,7));
      +-------+---+
      | (5,5) | 5 |
      +-------+---+
      |     0 | 5 |
      |     1 | 2 |
      |     1 | 2 |
      |     1 | 2 |
      +-------+---+
      4 rows in set (0.000 sec)
      

      If VALUES is used as a subquery, the anomaly propagates:

      MariaDB [test]> SELECT COUNT(*) FROM (VALUES ((1, 2))) v;
      Query OK, 0 rows affected (0.000 sec)
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            f_razzoli Federico Razzoli
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.