Null integer not allowed in MySQL 5 ???

Hi All,

I have very weird problem. I'm trying to setup replication between two database servers - one MySQL 4.1, the other 5.0. It's only for testing purposes, as we're going to switch to the newer one once we're happy with tests.

However, after i import SQL dump, databases looks identical. However, MySQL 5 after running query:

INSERT INTO tblpolicylist (
ClientID, ProductGroup, Product, ProductType, RefID, PolicyStatus, Referer, OfferID , OwnerID
) VALUES (
'112402','Household','1','22','079580298' , 'New Business' , '' , '' , '91'
);

is coming back with error "Incorrect integer value: '' for column 'Referer' at row 1' " . It's interesting, cause on MySQL 4.1 the same query is working just fine. Table is exact repliaca of the one from 4.1, Referer field is integer, with null allowed... Of course if I replace '' with '0', query is working fine, but I need to have this value null... It's also causing problems with replications, as similar queries are returning error on 5.0 slave.

Any ideas?
dannydudekAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
'' is a string value, and NOT a integer. MySQL 5 is a bit more picky about implicit data type conversions..

try this (I removed the single quotes for ALL the values that I assume that have numerical data type, and put NULL instead of '' ...

INSERT INTO tblpolicylist (
ClientID, ProductGroup, Product, ProductType, RefID, PolicyStatus, Referer, OfferID , OwnerID
) VALUES (
112402,'Household', 1 , 22,'079580298' , 'New Business' , NULL , NULL , 91
);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dannydudekAuthor Commented:
Thanks for that, however that means I would have modified application that is using database as well as data in the primary database (4.1).

Is there no way I could enable "less picky" legacy mode in handling integers or so?
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
not that i know.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.