coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 upgrading => Topic started by: jesperd on July 21, 2006, 01:40:34 AM

Title: Cannot insert new records
Post by: jesperd on July 21, 2006, 01:40:34 AM
I have just migrated the entire database from one server (MySQL 4.1.9) to another (MySQL 5.0.22) and it looks as if all primary keys (?) are missing from insert statements.

When I add a comment the message is "mySQL error: Field 'msg_id' doesn't have a default value"
When e.g. rate a picture the message is "mySQL error: Field 'sid' doesn't have a default value"
New albums: "mySQL error: Field 'aid' doesn't have a default value"
etc

I upgraded from 1.4.6 to 1.4.8 but that didn't help.

Any help on this is much appreciated.

Jesper
Title: Re: Cannot insert new records
Post by: Joachim Müller on July 21, 2006, 07:04:44 AM
The primary keys are there - mySQL5 complains about missing default values (because it is more strict than mySQL4). Add the default values if you know your way around (using phpMyAdmin). Take a look at sql/schema.sql to get an idea what the default values should look like.
Title: Re: Cannot insert new records
Post by: jesperd on July 21, 2006, 09:40:11 AM
Thanks, that did the trick. I went to MySQL Admin, Catalog, chose the database and checked the "autoincrement" option for the integer primary keys in each table.
Title: Re: Cannot insert new records
Post by: Joachim Müller on July 22, 2006, 04:30:36 PM
That's not the fix for the error message you posted above. However, if it works for you, then fine.

@all others who have similar issues: the autoincrement and the default value issue are entirely different animals.
Title: Re: Cannot insert new records
Post by: jesperd on July 24, 2006, 12:07:28 AM
I understand that, but looking at the schema.sql file as you suggested, I noticed that the msg_id field of the comments table had the autoincrement proptery, and no default value. And as it was msg_id that it had complaints about, I set the auto increment property.
Although the error msg was about default values, having a default value on a primary key didn't make much sense to me (I admit that I'm not a db expert). Anyway, it appears to be working now, if not, I'm sure I'll call for help again  :) Thanks again.