Sql Errors

I am getting SQL insert errors on several things if I do not specifically enter a value in a place where by default there is no value.

For example, if I do not enter a value for “Pause before answer” in an incoming route, I get the following:

FATAL ERROR
INSERT INTO incoming (cidnum,extension,destination,privacyman,pmmaxretries,pmminlength,alertinfo, ringing, mohclass, description, grppre, delay_answer, pricid) values (’’,’’,‘from-did-direct,2000,1’,‘0’,‘3’,‘10’,’’, ‘’, ‘default’, ‘Default’, ‘’, ‘’, ‘’) [nativecode=1366 ** Incorrect integer value: ‘’ for column ‘delay_answer’ at row 1]SQL -
INSERT INTO incoming (cidnum,extension,destination,privacyman,pmmaxretries,pmminlength,alertinfo, ringing, mohclass, description, grppre, delay_answer, pricid) values (’’,’’,‘from-did-direct,2000,1’,‘0’,‘3’,‘10’,’’, ‘’, ‘default’, ‘Default’, ‘’, ‘’, ‘’)

Any thoughts on a fix for this??

Hmmm, I am looking in my magic crystal ball but it wont tell me what I need so I ask you:

What version of FreePBX?
Is this a distro or a self-setup system?
Where in FreePBX do you get this error?

Sorry for not including all that. :frowning:

Version: 2.7.0 with all modules updated to the latest

Setup Type: Manual setup of all components on latest stable debian. MySql server is on a different host from the FreePBX system.

Location of error: This particular error happens when trying to create or update an inbound route. If I enter a value for the “Pause before answer” field the SQL works fine.

I also get the same type of error when trying to create or update a ring group. Just the field that causes the error is different.

Here are the instructions I followed: http://www.corenetworks.com.au/wiki/doku.php?id=install_voip_server

I would normally say it is a bug as we are inserting “” vs. 0 in some cases into an integer field, as the default. However, it’s been this way for a long time and it is not generally failing.

The DB also has a default NULL setting. What version of MySQL are you using that this is occurring?

You are welcome to report a bug that we should probably be changing any blank values to 0 (or NULL) when we do the insert but … as mentioned, it is not generally failing so it would be interesting to know what is different on your setup. The fact that your DB is remote should not matter, but the version might.

Running 5.1.42-community

I will look into the default NULL setting

Ok, so I did some digging on the “nativecode=1366” part of the error. I found that if I turned off the default strict mode in MySQL the problem goes away. Maybe this was not a default on earlier versions of MySQL and now is.

Thanks for everyone’s time.

don’t know about the default mode in MySQL. However, as mentioned, we probably are wrong and you are welcome to report a bug on the issue since technically it is wrong.

I wouldn’t be surprised though if there are other similar issues when in strict mode like that.

A post was split to a new topic: SQL Errors