Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pandora Console installation in strict SQL mode #144

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

vice
Copy link

@vice vice commented Jun 17, 2020

Try to make Pandora FMS work in SQL strict mode.
For now just the installation of the Pandora Console was fixed. Installed in a MariaDB Galera Cluster with its default SQL strict mode. Other database use by Pandora Server for example have issues with SQL strict mode.

I think I have found that network components with id_nc 786 and up try to insert wrong values. See issue #145 . Once this issue is fixed, commit 84df0fb could be reverted.

Catching errors is one of the main reason to try to comply with SQL strict mode.

vice added 5 commits May 28, 2020 22:35
Stricter SQL and compatible with more database engines
Better could be to omit the column completely

Signed-off-by: Vicente Jimenez Aguilar <googuy@gmail.com>
No implicit value provided so it is better to not try to insert id_np
and let database engine automatically increments its value

Stricter and more compatible SQL

Signed-off-by: Vicente Jimenez Aguilar <googuy@gmail.com>
Those defaults are present in pandoradb_migrate_6.0_to_7.0.mysql.sql

It works for MariaDB since version 10.2.1
https://mariadb.com/kb/en/create-table/#default-column-option

And no current MySQL version supports default value in text columns
https://dev.mysql.com/doc/refman/8.0/en/blob.html

Database engines that do not support default values in text
simply throws a warning when creating or altering tables

Signed-off-by: Vicente Jimenez Aguilar <googuy@gmail.com>
Avoids errors for data engines that do not accept default value in text
columns and are run in strict SQL mode when installer load initial data.

Inspection of PHP code needs to be done to avoid any futher error at
runtime for a database engine without default value in text columns and
run in strict SQL mode.

Signed-off-by: Vicente Jimenez Aguilar <googuy@gmail.com>
Installing Pandora Console with a database in SQL strict mode
when creating network components with id_nc 786 and up
produces many errors 1366 for incorrect values types
and 1265 for truncated data

Apparently, values are wrongly placed but in permisive mode those values
get replaced with just a warning and others that type match get inserted
in wrong column

Signed-off-by: Vicente Jimenez Aguilar <googuy@gmail.com>
@vice vice changed the title Strict sql mode Fix Pandora Console installation in strict SQL mode Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant