On 1/10/2020 6:34 AM, Wanderlei Huttel wrote:
Hello Erwan

First of all, MariaDB is not very recommended for using with Bacula, but you can use for you own risk.


This error is it looks is caused by SQL_MODE, that I guess is very similar of MySQL errors. Take a look in the link below: https://github.com/wanderleihuttel/bacula-utils/blob/master/dicas/mysql_sql-mode.md


Yes, it could be caused by STRICT_TRANS_TABLES being set in SQL_MODE if there is no default set for the StartTime column.

However, I have a Bacula instance running on Centos 7 and using MariaDB and see that the StartTime column in the Job table indeed does have default value set (as NULL). StartTime is a datetime, so I believe the default value of NULL is valid and should not be caught by STRICT_TRANS_TABLES.

Check the Job table. There should be a default set for StartTime. If not, then something created or altered the StartTime column in the Job table incorrectly. I believe it should have a default set.



Best regards

*Wanderlei Hüttel*



Em sex., 10 de jan. de 2020 às 07:46, Erwan RIGOLLOT <er...@rigollot.eu <mailto:er...@rigollot.eu>> escreveu:

    Hi all,

    Happy to new year!

    So, I have trie with Mariadb Server version: 10.2.29-MariaDB-log.
    I have restore bacula database before all my update and run
    update_mysql_tables with success.

    But, when I start a backup I get this message again :
    Fatal error: sql_create.c:84 Create DB Job record INSERT INTO Job
    (Job,Name,Type,Level,JobStatus,SchedTime,JobTDate,ClientId,Comment)
    VALUES
    
('Backup-obiwan.2020-01-10_10.34.15_03','Backup-obiwan','B','I','C','2020-01-10
    10:34:14',1578648854,1,'') failed. ERR=Field 'StartTime' doesn't
    have a default value

    I don't understand. If mysql cause that, why with Mariadb is the
    same ?

    And in the script update_mysql_table, I see it:
    ALTER TABLE Job    ALTER COLUMN StartTime    DROP DEFAULT;

    Regards,

    Erwan

    -----Message d'origine-----
    De : William Muriithi <will...@perasotech.com
    <mailto:will...@perasotech.com>>
    Envoyé : lundi 23 décembre 2019 15:58
    À : Erwan RIGOLLOT <er...@rigollot.eu <mailto:er...@rigollot.eu>>;
    bacula-users@lists.sourceforge.net
    <mailto:bacula-users@lists.sourceforge.net>
    Objet : Re: /usr/libexec/bacula/update_mysql_tables

    Hi Erwan,

    Honestly, your problem has nothing to do with bacula, its purely
    database related.

    First, if you insist on using mysql 8, you can't use the version
    you are using.  You need at least Bacula Release 9.4.3.  This is
    because you will need this bug fix.

    Change mysql my_bool to bool as it was removed from mysql  - Done
    on May 2019


    Second, the error bacula reported during insert "ERR=Field
    'StartTime' doesn't have a default value" is because, previously
    mysql used to allow null dates.  Current sql_mode don't allow that
    any more.  Google on sql_mode and dates and you should get an idea
    on what to do that suites Gentoo.

    In short, your pains are all caused by mysql and require just
    mysql skills to resolve.

    Regards,
    William

    ________________________________________
    From: Erwan RIGOLLOT <er...@rigollot.eu <mailto:er...@rigollot.eu>>
    Sent: December 23, 2019 9:41 AM
    To: bacula-users@lists.sourceforge.net
    <mailto:bacula-users@lists.sourceforge.net>
    Subject: Re: [Bacula-users] /usr/libexec/bacula/update_mysql_tables

    Hi all,

    Anyone can help me ?

    Thanks

    Erwan

    -----Message d'origine-----
    De : Erwan RIGOLLOT <er...@rigollot.eu <mailto:er...@rigollot.eu>>
    Envoyé : jeudi 28 novembre 2019 16:18
    À : bacula-users@lists.sourceforge.net
    <mailto:bacula-users@lists.sourceforge.net>
    Objet : Re: [Bacula-users] /usr/libexec/bacula/update_mysql_tables

    Hi William and all,

    I have a catalog backup before update.
    So I have try this "sql_mode = NO_ENGINE_SUBSTITUTION" because I
    would like to keep version of my distribution (gentoo).
    (But if i have to do different, i will do).

    The script /usr/libexec/bacula/update_mysql_tables run good:
    This script will update a Bacula MySQL database from version 12-15
    to 16

    Depending on the current version of your catalog, you may have to
    run this script multiple times.

    Enter password:
    Enter password:
    Update of Bacula MySQL tables 15 to 16 succeeded.
    Enter password:

    So I try to do backup, and doesn't work :
    28-nov. 16:13 obiwan-dir JobId 0: Fatal error: sql_create.c:84
    Create DB Job record INSERT INTO Job
    (Job,Name,Type,Level,JobStatus,SchedTime,JobTDate,ClientId,Comment)
    VALUES
    
('Backup-tardis.2019-11-28_16.13.50_03','Backup-tardis','B','I','C','2019-11-28
    16:13:48',1574954028,5,'') failed. ERR=Field 'StartTime' doesn't
    have a default value

    I don't understand because the script update_mysql_tables remove
    default value ?!?

    Can you help me ?

    Thanks and have a good day !



    -----Message d'origine-----
    De : William Muriithi <will...@perasotech.com
    <mailto:will...@perasotech.com>> Envoyé : vendredi 22 novembre
    2019 16:41 À : Erwan RIGOLLOT <er...@rigollot.eu
    <mailto:er...@rigollot.eu>>; bacula-users@lists.sourceforge.net
    <mailto:bacula-users@lists.sourceforge.net>
    Objet : Re: /usr/libexec/bacula/update_mysql_tables


    Hi Erwan,

    Hope you had made a catalog backup before schema upgrade.

    You can't use bacula 9.0 with mysql 8.   mysql made some change
    that were only fixed in a later bacula version, think bacula 9.2.

    So if you have to use mysql 8, please use the latest bacula
    binaries.  Alternatively, use Mariadb, which would be my advice as
    it don't change your plans at all.

    Also, change the sql mode to match that of earlier versions.
    Something like this "sql_mode = NO_ENGINE_SUBSTITUTION"

    Anyway, all this depends on whether you have a backup.

    Regard,
    William






    From: Erwan RIGOLLOT <er...@rigollot.eu <mailto:er...@rigollot.eu>>

    Sent: November 22, 2019 9:50 AM

    To: bacula-users@lists.sourceforge.net
    <mailto:bacula-users@lists.sourceforge.net>
    <bacula-users@lists.sourceforge.net
    <mailto:bacula-users@lists.sourceforge.net>>

    Subject: [Bacula-users] /usr/libexec/bacula/update_mysql_tables




    Hello,

    I have try to update bacula database after update Mysql (8.0.17)
    and bacula ( 9.0.8-r1).

    I have get this result and backup don't work .... :


    This script will update a Bacula MySQL database from version 12-15
    to 16

    Depending on the current version of your catalog, you may have to
    run this script multiple times.

    mysql: [Warning] Using a password on the command line interface
    can be insecure.
    mysql: [Warning] Using a password on the command line interface
    can be insecure.
    ERROR 1067 (42000) at line 3: Invalid default value for 'FirstWritten'
    ERROR 1060 (42S21) at line 4: Duplicate column name 'VolParts'
    ERROR 1067 (42000) at line 5: Invalid default value for 'FirstWritten'
    ERROR 1067 (42000) at line 6: Invalid default value for 'FirstWritten'
    ERROR 1067 (42000) at line 7: Invalid default value for 'FirstWritten'
    ERROR 1067 (42000) at line 13: Invalid default value for 'StartTime'
    ERROR 1067 (42000) at line 14: Invalid default value for 'SchedTime'
    ERROR 1067 (42000) at line 15: Invalid default value for 'SchedTime'
    ERROR 1067 (42000) at line 16: Invalid default value for 'SchedTime'
    ERROR 1067 (42000) at line 17: Invalid default value for 'StartTime'
    ERROR 1067 (42000) at line 18: Invalid default value for 'SchedTime'
    ERROR 1067 (42000) at line 19: Invalid default value for 'SchedTime'
    ERROR 1067 (42000) at line 20: Invalid default value for 'SchedTime'
    ERROR 1067 (42000) at line 23: Invalid default value for 'LastWritten'
    ERROR 1067 (42000) at line 24: Invalid default value for
    'FirstWritten'
    ERROR 1067 (42000) at line 25: Invalid default value for
    'FirstWritten'
    ERROR 1067 (42000) at line 26: Invalid default value for
    'FirstWritten'
    ERROR 1067 (42000) at line 29: Invalid default value for 'SchedTime'
    Update of Bacula MySQL tables 15 to 16 succeeded.
    mysql: [Warning] Using a password on the command line interface
    can be insecure.


    Thanks,

    Erwan



    _______________________________________________
    Bacula-users mailing list
    Bacula-users@lists.sourceforge.net
    <mailto:Bacula-users@lists.sourceforge.net>
    
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fbacula-users&amp;data=02%7C01%7Cerwan%40rigollot.eu%7C7281801eca1f4f0fae2c08d787b87c7b%7C61b429f8f50a44a2aea1286497c97ee3%7C0%7C0%7C637127098752631759&amp;sdata=aGvuDQTO8mFXPx9pFspWa4od8N%2BhNYlAHAoz7Yc4ZbQ%3D&amp;reserved=0


    _______________________________________________
    Bacula-users mailing list
    Bacula-users@lists.sourceforge.net
    <mailto:Bacula-users@lists.sourceforge.net>
    
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fbacula-users&amp;data=02%7C01%7Cerwan%40rigollot.eu%7C7281801eca1f4f0fae2c08d787b87c7b%7C61b429f8f50a44a2aea1286497c97ee3%7C0%7C0%7C637127098752641754&amp;sdata=uCvNRuGzoMpF9wysvjoNxCLGykbEbJcFUAaN08EDCIo%3D&amp;reserved=0


    _______________________________________________
    Bacula-users mailing list
    Bacula-users@lists.sourceforge.net
    <mailto:Bacula-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/bacula-users



_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to