Last updated March 14, 2014. Created on February 4, 2012.
Edited by batigolix, vincent sg. Log in to edit this page.


Some of the fields in the database lost their default values.

Drupal produces errors like

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'users' doesn't have a default value: INSERT INTO {node} (vid, type, language, title, uid, status, created, changed, promote, sticky) VALUES ...

In this case the node table has a users column that has no default value. In Drupal 7 this column does not exist by default but it may be a left over from several upgrades (Drupal 4 --> Drupal7).


Fast method

Use a tool like phpmyadmin or the drush command sqlq to run a query that assigns a default value to the column in question.

In the case described above the sql to fix the problem is:


Manual Method (45 mins to 1.5 hr)

1. Put your site to offline mode.

2. Backup all your databases and files (Important).

3. Install Drupal (same version) to another fresh database. Do NOT uninstall your existing site.

4. Enable the same modules (same version). Run update.php.

5. Open phpMyAdmin and select the new Drupal database.

6. Open phpMyAdmin and select the faulty Drupal database.

7. Select a table (same name in the new database and faulty database).

8. Select 'Structure' tab (on both sides).

9. Compare the 'Name' and 'Default' columns. Pay attention to blanks (in the new database) and 'None' (in the faulty database).

10. If you see any difference in 'Default' values, select 'Change' (Pencil icon) on the faulty database. If no difference, proceed to step 7 or 14.

11. Under 'Default', select 'As defined:'.

12. Select 'Save'.

13. Repeat steps 9 to 12 until the 'Default' values are the same.

14. Repeat steps 7 to 13 until all the 'Default' values in all the tables are the same.

15. Put your site to online mode.

16. Make sure that your site is functioning normally.

17. Remove the installation done in step 3.

Looking for support? Visit the forums, or join #drupal-support in IRC.


fleuv’s picture

For people working with hook_schema and are dealing with the same problem.

Non of these methods will work. You should make sure that you've added all table columns to your hook_schema fields. After that you should clean all cache! This problem occurred for me after adding a new column in phpmyadmin manually.

lsabug’s picture

My PDOException is:

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'bid' doesn't have a default value: INSERT INTO {block} (module, delta, theme, status, weight, region, pages) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => addtoany [:db_insert_placeholder_1] => addtoany_button [:db_insert_placeholder_2] => themename [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => -1 [:db_insert_placeholder_6] => ) in drupal_write_record() (line 7308 of C:\inetpub\wwwroot\domain\includes\

The error produces a wsod whenever I enable a module (addtoany, sharethis, addthis) that creates a block and prevents me from clearing cache with performance or visiting the blocks page. When disabled I can access these two pages.

I found a post that stated it was due to not having a value in one of the fields. I imagine it was array db_insert_placeholder_6 but running the above sql resulted in the message that there are no null fields. I had created an issue in the ShareThis project but found that it was occurring with other similar modules.


The fix for me using the AddtoAny module was to rebuild permissions.

Once I did that I was able to navigate to both blocks and performance pages.