Help with libdbi code

John Ralls jralls at
Tue May 10 11:45:25 EDT 2016

> On May 7, 2016, at 2:14 PM, Colin Law <clanlaw at> wrote:
> On 7 May 2016 at 21:44, Colin Law <clanlaw at> wrote:
>> ...
>> I am running with
>> type_name = "TIMESTAMP NULL";
>> and have not found any problems so far.
> On further investigation I am getting errors.  When I attempt to save
> as mysql I get
> CRIT <gnc.backend.dbi> [mysql_error_fn()] DBI error: 1067: Invalid
> default value for 'date_closed'
> This is related to gnc-order-sql.c line 64.  I suspect the orders
> table does not use BCT_DATETIME for its column definitions.
> Will investigate further tomorrow.

It uses CT_TIMESPEC as the column type; that normally invokes add_timespec_col_info_to_list() which sets the field type to BCT_DATETIME.

The error is because the timespec columns in order are also specified as NOT_NULL, as they are also in the entry and price tables.

John Ralls

More information about the gnucash-devel mailing list