Help with libdbi code

John Ralls jralls at
Sat May 7 10:23:36 EDT 2016

> On May 7, 2016, at 9:00 AM, Colin Law <clanlaw at> wrote:
> On 7 May 2016 at 12:23, Colin Law <clanlaw at> wrote:
>> On 7 May 2016 at 12:01, John Ralls <jralls at> wrote:
>>> Hmm, the trace files from the bug report seemed to show that the error was from saving a slot row with a 0-valued date rather than from creating a table with a default value of 0.
>> No doubt you are right (again), it is probably not the actual creation
>> but the writing that is the issue.  Me jumping to conclusions again.
>> I will investigate whether it is necessary to change the options for
>> creating the db.
> Actually, looking at the trace file again, it appears we were both
> correct.  The first error in the file is
> CRIT <gnc.backend.dbi> [mysql_error_fn()] DBI error: 1067: Invalid
> default value for 'date'
> where it is complaining about the default value being 0, and later
> there are errors complaining about writing into the slots table with a
> NULL value for a date.

Good eye, I'd missed the default value error.

The complaint about writing a NULL bothers me. I interpreted that as the C meaning of NULL, but what if it means a SQL NULL? If NO_ZERO_DATES means that date fields are implicitly NOT_NULL then we're back to defining MIN_DATE or MAX_DATE to stand in for no entry.

John Ralls

More information about the gnucash-devel mailing list