CMS Blocks: Integrity constraint violation: 1062 Duplicate entry '0-' for key 'UNQ_page_url'

Issue #25 resolved
Alan Storm created an issue

With the current form validation and unique indexing setup, it's common to receive the above confusing error message when attempting to create blocks without a page-url

Screen shot 2014-02-22 at 1.19.13 PM.png

Reproduction Steps.

  1. Log into the admin

  2. Click on CMS -> Block

  3. Click the "New CMS Block" button

  4. Enter the value bad-key-example into the handle field and click the "save" button

  5. Click the "New CMS Block" button

  6. Enter the value bad-key-example2 into the handle field and click the "save" button

Expected Behavior: Should be able to save the second block

Actual Behavior: System reports a

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-' for key 'UNQ_page_url'

error.

This appears to be due to the UNQ_page_url key. This may be fixable by ensuring page_url is populated as NULL instead of an empty string when there's a blank value.

Comments (1)

  1. Log in to comment