Details
-
Bug
-
Status: In Progress (View Workflow)
-
Critical
-
Resolution: Unresolved
-
11.5.2, 11.6.2
-
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
Issue Links
- is caused by
-
MDEV-9101 Limit size of created disk temporary files and tables
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
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.
This *seems* to be linked to the usage of filesort. 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: {code:sql} SELECT (SELECT CONCAT(partner.companyName, partner.lastName) FROM test_partner partner WHERE delivery_fk = mvt.id) AS val FROM test_movement mvt WHERE mvt.documentId > 'a'; {code} You will get the error. The `WHERE mvt.documentId > 'a';` filter is necessary to trigger the bug. Using docker: {code:bash} # Setup a clean mariadb docker run --rm --name mariadb_test -d --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:11 # 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 {code} |
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: {code:sql} SELECT (SELECT CONCAT(partner.companyName, partner.lastName) FROM test_partner partner WHERE delivery_fk = mvt.id) AS val FROM test_movement mvt WHERE mvt.documentId > 'a'; {code} You will get the error. The `WHERE mvt.documentId > 'a';` filter is necessary to trigger the bug. Using docker: {code:bash} # Setup a clean mariadb docker run --rm --name mariadb_test -d --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:11 # 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 {code} |
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: {code:sql} SELECT (SELECT CONCAT(partner.companyName, partner.lastName) FROM test_partner partner WHERE delivery_fk = mvt.id) AS val FROM test_movement mvt WHERE mvt.documentId > 'a'; {code} You will get the error. The `WHERE mvt.documentId > 'a';` filter is necessary to trigger the bug. Using docker: {code:bash} # Setup a clean mariadb docker run --rm --name mariadb_test -d --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:11 # 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 {code} |
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: {code:sql} 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'; {code} You will get the error. The `WHERE mvt.documentId > 'a';` filter is necessary to trigger the bug. Using docker: {code:bash} # Setup a clean mariadb docker run --rm --name mariadb_test -d --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:11 # 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 {code} |
Attachment | data.7z [ 74321 ] |
Attachment | final.7z [ 74322 ] |
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: {code:sql} 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'; {code} You will get the error. The `WHERE mvt.documentId > 'a';` filter is necessary to trigger the bug. Using docker: {code:bash} # Setup a clean mariadb docker run --rm --name mariadb_test -d --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:11 # 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 {code} |
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: {code:sql} 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'; {code} You will get the error. The `WHERE mvt.documentId > 'a';` filter is necessary to trigger the bug. Using docker: {code:bash} # 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 {code} |
Affects Version/s | 11.6.2 [ 29908 ] | |
Affects Version/s | 11.5.2 [ 29838 ] |
Labels | regression |
Fix Version/s | 11.7 [ 29815 ] |
Attachment | MDEV-35592.7z [ 74330 ] |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Assignee | Sergei Golubchik [ serg ] |
Assignee | Sergei Golubchik [ serg ] | Michael Widenius [ monty ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Fix Version/s | 11.8 [ 29921 ] | |
Fix Version/s | 11.7(EOL) [ 29815 ] |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Assignee | Michael Widenius [ monty ] | Oleksandr Byelkin [ sanja ] |
Thanks! I repeated as described on 11.5+.
It is caused by b9f5793176 or 865ef0f567 (with b9f5793176 I've got compile errors, so not able to check exactly)
I add MDEV-35592.test - nearly the same test, but in 1 file and for running with mtr