Problem/Motivation
Where there is only 1 subfield of a data field, it is possible to delete it but then the field become unmanageable.
Steps to reproduce
Create a data field with a subfield.
Delete this data field.
Edit the field: in the "field settings" tab throws error 500 and also trying to delete the datafield throws error 500 with
Uncaught PHP Exception Drupal\Core\Database\DatabaseExceptionWrapper:
"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 1 OFFSET 0' at line 5: SELECT 1 AS "expression" FROM "product__field_test_" "t" WHERE LIMIT 1 OFFSET 0; Array ( )"
at /web/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php line 46
Comments
Comment #2
lazzyvn commentedIt's true, I have never tested this case. Can you debug and create a patch?
Comment #3
giuse69 commentedI am available for testing but I am not a Drupal developer, sorry....
Comment #6
lazzyvn commented- when creating new field drupal by creating table with column field_name_value when we delete subfield it deletes this column so it must have at least one subfield, Fixed by removing delete button for last subfield in setting storage