Bacula-users

Re: [Bacula-users] Bacula 9.0.0 - 'StartTime' doesn't have a default value

2017-07-16 15:12:35
Subject: Re: [Bacula-users] Bacula 9.0.0 - 'StartTime' doesn't have a default value
From: Kern Sibbald <kern AT sibbald DOT com>
To: Phil Stracchino <phils AT caerllewys DOT net>, bacula-users AT lists.sourceforge DOT net
Date: Sun, 16 Jul 2017 21:11:38 +0200
Hello Phil,

According to the documentation in both MySQL and MariaDB, I can use "0000-00-00 00:00:00". I might have missed something though. It seems to work fine with MariaDB 10.0. I will test it with MariaDB 10.2 and with the current Ubuntu 16.04 version of MySQL, and if it works, I will probably use that, unless someone can see some major downside. In the mean time, providing you do not change a default MariaDB/MySQL, Bacula 7.4.x and 9.0.x seem to work fine.

Best regards,

Kern


On 07/16/2017 08:27 PM, Phil Stracchino wrote:
On 07/16/17 04:52, Kern Sibbald wrote:
Hello,

It sounds like this is another change in MySQL in a newer version.
Previously they prohibited a DEFAULT 0  for the start time, because zero
is not a permitted value, even though the field is a Unix Time stamp,
where 0 is a perfectly valid time.  Consequently we removed the
DEFAULT.  Apparently, they now require a start time.  The problem is
that Bacula counts on the default start time to be zero in some of the
database records (the Media record I think).  Note: in the Job record,
there is no start time when the Job is created.  The start time is known
only when the Job begins running, so the default value must be zero.

The actual status here:

With default SQL_MODE, MySQL 5.6 and later prohibit NOT NULL without
DEFAULT, and 5.7 and later prohibit zero date or dates with zero parts.
You can have zeroes in the TIME part of a DATETIME or TIMESTAMP column,
but zero fields in the DATE part are prohibited because there is no
year, month or day 0.

The canonical "correct default" for DATETIME fields is the Unix epoch.
However is your code is dependent upon a 0 default, you can manually set
a SQL_MODE that does *NOT* include NO_ZERO_DATE or NO_ZERO_IN_DATE.




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users


ADSM.ORG Privacy and Data Security by https://kimlaw.us