Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293320

Creating Custom Block with same name as existing block throws SQL error

$
0
0

If you attempt to create a custom block with the same name (machine name) as another existing block, an error occurs. If you're using the overlay to create the block, the page has almost no information, but with the overlay turned off you get the following error:

Error message
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Test Block 1' for key 'info': INSERT INTO {custom_block} (id, uuid, info, revision_id, type, langcode) VALUES (default, :db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 055d4dde-8b0b-4b47-a900-ec61bd1c32a8 [:db_insert_placeholder_1] => Test Block 1 [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => basic [:db_insert_placeholder_4] => und ) in Drupal\Core\Entity\DatabaseStorageControllerNG->save() (line 339 of /home/trevor/drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php).
The website has encountered an error. Please try again later.

Presumably you'd want to check that a block existed before attempting to insert it.


Viewing all articles
Browse latest Browse all 293320

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>