>>>>> On Fri, 10 May 2024 14:04:50 -0400, Phil Stracchino said: > > On 5/10/24 14:01, Martin Simmons wrote: > > But I think you are mixing two different concepts: in CREATE TABLE, a > > DEFAULT > > just specifies what INSERT does if the column is omitted; NOT NULL is a > > constraint that applies all the time. It is quite reasonable to specify NOT > > NULL for a column that must always be given a value in an INSERT statement. > > > Oh yes, absolutely. That's its *purpose*. "Column is not allowed to be > NULL." Where thew problem can arise is if you don't supply a value for > a column that you've told the DB is not allowed to be NULL, but you > haven't given it an explicit DEFAULT to use if you don't supply a value, > and you're in STRICT mode so the DB won't fill in an *implicit* default. > > What happens then is that the DB throws an error on the query — which is > probably what you *want* to happen.
You describe that as a problem, but would call it a solution -- it tells you that you have a bug in the program doing the INSERT. File.FileIndex is a good example of this in fact, because each row is supposed to have a unique value within each job, so any fixed default will be wrong. __Martin _______________________________________________ Bacula-devel mailing list Bacula-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-devel