Cannot insert new records Cannot insert new records
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Cannot insert new records

Started by jesperd, July 21, 2006, 01:40:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jesperd

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

Joachim Müller

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.

jesperd

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.

Joachim Müller

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.

jesperd

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.