Bacula-users

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

2017-07-16 14:29:33
Subject: Re: [Bacula-users] Bacula 9.0.0 - 'StartTime' doesn't have a default value
From: Phil Stracchino <phils AT caerllewys DOT net>
To: bacula-users AT lists.sourceforge DOT net
Date: Sun, 16 Jul 2017 14:27:32 -0400
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.


-- 
  Phil Stracchino
  Babylon Communications
  phils AT caerllewys DOT net
  phil AT co.ordinate DOT org
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958

------------------------------------------------------------------------------
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