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

uuid() function evaluates at wrong time in query

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2.13, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
    • 5.5.60, 10.0.35, 10.1.33, 10.2.15, 10.3.6
    • OTHER
    • Darwin crest.fritz.box 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

    Description

      The following code returns one uuid with count 10 instead of 10 uuids with count 1 for each line.

      mysql test --execute 'select count(1), uuid() as uid from seq_0_to_9 group by uid;'
      

      This seems as if the uuid function is only ever actually called once, instead of once for each element in the sequence.

      This does not happen fi you leave of the group by like this:

      mysql yeepa_test --execute 'select seq, uuid() as uid from seq_0_to_9;'
      

      To my understanding this is wrong and the sequence should return 10 uuids with a count of one each.

      Attachments

        Issue Links

          Activity

            Hi there, can you reproduce this?

            dwt Martin Häcker added a comment - Hi there, can you reproduce this?

            Reproducible on MariaDB 5.5-10.3 and MySQL 5.5-5.7. Not reproducible on MySQL 8.0.

            cvicentiu, bar, see also MDEV-15624, so that you don't do double work.

            elenst Elena Stepanova added a comment - Reproducible on MariaDB 5.5-10.3 and MySQL 5.5-5.7. Not reproducible on MySQL 8.0. cvicentiu , bar , see also MDEV-15624 , so that you don't do double work.
            bar Alexander Barkov added a comment - - edited

            The same problem is repeatable with a real table instead of a sequence:

            DROP TABLE IF EXISTS t1;
            CREATE TABLE t1 (id INT);
            INSERT INTO t1 VALUES (1),(2),(3);
            SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid;
            

            +----------+--------------------------------------+
            | COUNT(1) | uid                                  |
            +----------+--------------------------------------+
            |        3 | 339b0600-3735-11e8-95ee-902b3433f757 |
            +----------+--------------------------------------+
            

            bar Alexander Barkov added a comment - - edited The same problem is repeatable with a real table instead of a sequence: DROP TABLE IF EXISTS t1; CREATE TABLE t1 (id INT ); INSERT INTO t1 VALUES (1),(2),(3); SELECT COUNT (1), UUID() as uid FROM t1 GROUP BY uid; +----------+--------------------------------------+ | COUNT(1) | uid | +----------+--------------------------------------+ | 3 | 339b0600-3735-11e8-95ee-902b3433f757 | +----------+--------------------------------------+

            People

              bar Alexander Barkov
              dwt Martin Häcker
              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.