Answers.Body: <p>Fixed in <a href="http://buildwithcraft.com/updates#build2588" rel="nofollow">Craft 2.2 build 2588</a>!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-24T00:43:54.490Z
Answers.Text: Thank ya! Works perfectly again.
Answers.UserDisplayName: Travis Gertz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-24T00:41:45.223Z
Answers.LastActivityDate: 2014-09-24T00:41:45.223Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>Since updating to 2.2.2587, anytime I edit an entry by adding a block on certain Matrix fields, it throws the following error:</p>
  
  <pre><code>Internal Server Error
  
  CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'field_text_markdown' cannot be null
  </code></pre>
  
  <p>It seems to throw the error if <em>any</em> of the blocks in that field contain a lightswitch field. It doesn't matter if the block with the lightswitch is actually added to the entry or not. In this case, my Matrix contains two switches, which are off by default.</p>
  
  <p>Throws the error whether the blocks with the switches are present or not… and doesn't seem to matter if I add the blocks with the switches and turn them on or off.</p>
  
  <p>Cheers!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-09-24T00:12:57.490Z
Comments.Text: This is going to end up being a bug with a change in the last update. Can you submit a ticket from your dashboard's Get Help widget and let it send along the database?
Comments.UserDisplayName: Brad Bell
Tags: <matrix><entry><error-message>
Title: Craft throwing an SQL error on Save when Matrix field has a lightswitch
ThreadText: # Craft throwing an SQL error on Save when Matrix field has a lightswitch
  
  (Asked by: username_0 on 2014-09-24)
  
  Since updating to 2.2.2587, anytime I edit an entry by adding a block on certain Matrix fields, it throws the following error:
  
  ```
  Internal Server Error
  
  CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'field_text_markdown' cannot be null
  
  ```
  
  It seems to throw the error if *any* of the blocks in that field contain a lightswitch field. It doesn't matter if the block with the lightswitch is actually added to the entry or not. In this case, my Matrix contains two switches, which are off by default.
  
  Throws the error whether the blocks with the switches are present or not… and doesn't seem to matter if I add the blocks with the switches and turn them on or off.
  
  Cheers!
  
  **Tags:** matrix, entry, error-message
  
  > **Comments:**
  > **username_1**: This is going to end up being a bug with a change in the last update. Can you submit a ticket from your dashboard's Get Help widget and let it send along the database?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-09-24. Score: 1 | Accepted answer
  
  Fixed in [Craft 2.2 build 2588](http://buildwithcraft.com/updates#build2588)!
  
  > **Comments:**
  > **username_0**: Thank ya! Works perfectly again.  
  
  ---
  
  