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

ERROR 1062 (23000): Duplicate entry 'NULL' for key 'key0' on CONCAT in sub-query

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 11.5.2, 11.6.2
    • 11.7
    • None
    • Official docker image mariadb:11.6.2
      Also tested with mariadb 11.5.2

    Description

      For some SELECT queries with a CONCAT in a sub-query on a table with a lot of data, I get the "ERROR 1062 (23000): Duplicate entry 'NULL' for key 'key0'" error.

      I was able to get a minimal set of anonymised data to reproduce the issue.

      Step to reproduce :

      • Execute `01_schema.sql`
      • Execute `02_data_partner.sql`
      • Execute `03_data_movement.sql`

      Run the following query:

      SELECT (SELECT CONCAT(partner.companyName, partner.lastName)
              FROM test_partner partner
              WHERE mvt.delivery_fk = partner.id) AS val
      FROM test_movement mvt
      WHERE mvt.documentId > 'a';
      

      You will get the error.

      The `WHERE mvt.documentId > 'a';` filter is necessary to trigger the bug.

      Using docker:

      # Setup a clean mariadb
      docker run --rm --name mariadb_test -d --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:11.6
       
      # Create a test db
      docker exec mariadb_test mariadb -e 'CREATE DATABASE test'
       
      # Import schema
      docker exec -i mariadb_test mariadb test < 01_schema.sql
       
      # Import data
      docker exec -i mariadb_test mariadb test < 02_data_partner.sql
      docker exec -i mariadb_test mariadb test < 03_data_movement.sql
       
      # Execute the query to trigger the bug
      docker exec -i mariadb_test mariadb test < 04_query.sql
       
      # Cleanup
      docker stop mariadb_test
      

      Attachments

        1. final.7z
          7.45 MB
          Colin GILLE
        2. MDEV-35592.7z
          6.65 MB
          Alice Sherepa

        Issue Links

          Activity

            People

              monty Michael Widenius
              Congelli501 Colin GILLE
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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