General error: 1364 Field 'item_id' doesn't have a default value: INSERT INTO {queue}

Hassan Alhusseini
Hassan Alhusseini used Ask the Experts™
on
Hello,

 My site  work on drupal and mysql. Suddenly, it start to give me

"PDOException: SQLSTATE[HY000]: General error: 1364 Field 'item_id' doesn't have a default value: INSERT INTO {queue}........ "

"PDOException: SQLSTATE[HY000]: General error: 1364 Field 'vid' doesn't have a default value: INSERT INTO {node_revision}....."

 

The same sentence appears with different table name and variables whenever I do any action on the website.

 

The database is not in “Strict mode”. I added this

sql_mode = ""

to my.ini

 

but still not working

 

Please help


Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Ryan ChongSoftware Team Lead

Commented:
check the table design of fields item_id and vid, they cannot be NULL, so a non NULL value MUST be provided in your Insert SQL statements.
Ryan ChongSoftware Team Lead

Commented:
alternatively, set these fields to be able to accept NULL values, so your error shall be gone, but it depends on your application logic whether these fields are needed or optional.
When you last updated Drupal, did you run the database update it presumably needs?
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Author

Commented:
Hello Bernard

Thanks for your answer


I do not know if there was any update or not. But in all cases how can I update the database?

Thanks....
I found the solution

You just make the filed primary  and make it auto-increment by this

ALTER TABLE t1 MODIFY b INTEGER NOT NULL AUTO_INCREMENT;

Thank you all
Ryan ChongSoftware Team Lead

Commented:
You just make the filed primary  and make it auto-increment by this

ok, it implies that a non-null value need to be provided, as what i have mentioned earlier.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial