Error on install of MySql tables

Support requests, bug reports, questions etc.
Locked
trames
beginner
beginner
Posts: 6
Joined: Fri Jul 31, 2009 04:06

Error on install of MySql tables

Post by trames » Fri Jul 31, 2009 04:19

I am trying to install NConf. NConf and Nagios is on Linux, the MySql server is on windows.

I am getting an error when creating the tables (using manual install)

Command I run connecting to the MySql server from a Linux terminal
mysql -h mysqlserver -u nconf -p nconf < INSTALL/create_database.sql

Error:
ERROR 1265 (01000) at line 44: Data truncated for column 'link_as_child' at row 1


MySql version is 5.0.51b InnoDB is installed and running.
NConf version 1.2.5
Nagios version 3.1.2

What to do now?

trames
beginner
beginner
Posts: 6
Joined: Fri Jul 31, 2009 04:06

Re: Error on install of MySql tables

Post by trames » Fri Jul 31, 2009 04:35

This is an issue with the table configattrs. The link_as_child is an enum type. All the other enum types have at least two valid values. This one has one - "yes" - with a default of NULL. The INSERT sql line has '' instead of the word NULL.

Not sure which is wrong - the data type for the field or if the INSERT data for this field should be NULL instead of ''?

User avatar
agargiulo
NConf developer
NConf developer
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland
Contact:

Re: Error on install of MySql tables

Post by agargiulo » Fri Jul 31, 2009 11:24

Hi.

I don't think the ENUM is a problem. It can be left empty, since it is not explicitly defined as "NOT NULL". Unless maybe your MySQL version handles it differently and then I'm wrong.
I suspect it's more likely there is a problem with some of the data being inserted into the table. Can you do a few tests? Maybe create the table and do some manual inserts? It's the first time someone reports a problem with the install script.

Thanks.

trames
beginner
beginner
Posts: 6
Joined: Fri Jul 31, 2009 04:06

Re: Error on install of MySql tables

Post by trames » Fri Jul 31, 2009 16:42

Thanks for the reply.

I used phpMyAdmin to manually insert into the configattrs table. I left the link_as_child field blank and unchecked the null checkbox. phpMyAdmin formatted the field with a '' just like the script does.

I received the same error.

I changed the value in the INSERT statement to NULL and the record was accepted

I then edited the field link_as_child and changed the valid enum values to 'yes','' Did the same test, and the record was accepted. Apparently something has changed within MySql to only accept a valid enum value or NULL

I decided to change the valid enum values to 'yes','' in the install script for this field. The script then executed without error.

User avatar
agargiulo
NConf developer
NConf developer
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland
Contact:

Re: Error on install of MySql tables

Post by agargiulo » Mon Aug 03, 2009 10:04

Careful: setting the "link_as_child" attr to "yes" will have unexpected results. This could severely mess up your data in NConf! The attr should only be set to "yes" for the following attrs (NConf v1.2.5):

Code: Select all

+---------+--------------+---------------+---------------+
| id_attr | attr_name    | config_class  | link_as_child |
+---------+--------------+---------------+---------------+
|      59 | members      | contactgroup  | yes           |
|      74 | command_name | host-template | yes           |
|      29 | members      | hostgroup     | yes           |
|      72 | members      | servicegroup  | yes           |
+---------+--------------+---------------+---------------+
We will have to set this to "no" explicitly in the next release.

Thank you.

trames
beginner
beginner
Posts: 6
Joined: Fri Jul 31, 2009 04:06

Re: Error on install of MySql tables

Post by trames » Mon Aug 03, 2009 16:00

I did not set them to "yes", I simply changed the valid enum values in the field definition to accept the '' (two quote marks) so that the script would execute.

User avatar
agargiulo
NConf developer
NConf developer
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland
Contact:

Re: Error on install of MySql tables

Post by agargiulo » Fri Oct 09, 2009 16:31

This issue has been fixed and will be part of release 1.2.6. The ENUM was changed to ('yes','no') like all the other ENUM's.

Locked