GDA missing records retest (long)

Mark Johnson mrj001 at shaw.ca
Tue Mar 11 15:20:46 EDT 2008


Phil Longstaff wrote:
> Mark Johnson wrote:
>   
>> Since I have one extra account showing in the XML file, I checked to see 
>> if the DBs have the ROOT account in them.  They do not.  
>> QUESTION:  Is this a problem?
>>     
>
> The ROOT account was added somewhere in the 2.x series in GC.  It is not
> stored as an explicit account in the db.  Instead, the ROOT account's
> GUID is stored in the books table.  When the db is opened and the books
> table record is read, the ROOT account's GUID is set to the value in the
> books table record.
>   
OK, thanks.
>
>> Comparison of the guids for transactions and splits in each DB revealed 
>> 3 transactions guids were different in each DB.  The ones from MySql 
>> were not present in the XML.  Similarly there were 7 split guids that 
>> did not match in the different DBs.  I did not check for them in the 
>> XML.  This is consistent with 3 scheduled transactions being created 
>> with 7 splits.  Now, I wish I'd looked closer at that scheduled 
>> transaction dialog when I first opened the XML yesterday....  Despite 
>> this, I believe that these three are scheduled transactions.  
>> QUESTION:  Why do two of them have a entered_date in 2005?  Checking one 
>> against the XML shows that the last couple of entered_dates were in 
>> 2005, but before that they looked normal.
>>     
>
> I assume you opened 3 copies of GC with your XML data, each of which
> prompted you about scheduled transactions.  If so, it makes sense that
> each copy would have had different guids for the new transactions and
> splits.  Each transaction has an entered date and a posted date.  I
> believe the posted date is the one shown in the register.  Usually, the
> entered date is the date that you type in the transaction.  For a
> transaction resulting from a scheduled transaction, I don't know if the
> entered date is the date it is created or the date of the original sx.
>   
Yes, I did open three separate copies of the XML and save concurrently 
to the three DBs.  I should have explicitly stated that in my post.  I 
see I also forgot to include the version info regarding gnucash-gda and 
libgda.
>   
>> However, there was an excess of TWO transactions in the DBs, but THREE 
>> differing guids.  I was able to track this to a missing template 
>> transaction for a scheduled transaction.  Here is the corresponding 
>> entry in the PostgreSQL error log:
>> ERROR:  null value in column "currency_guid" violates not-null constraint
>> STATEMENT:  INSERT INTO transactions (guid, currency_guid, num, 
>> post_date, enter_date, description) VALUES 
>> ('16097c3be93a538e66e1de61ad743b0a', NULL, '', '2005-04-27', 
>> '2005-04-27', 'Telus')
>>
>> Here is the first portion of the XML:
>> <gnc:transaction version="2.0.0">
>>   <trn:id type="guid">16097c3be93a538e66e1de61ad743b0a</trn:id>
>>   <trn:date-posted>
>>     <ts:date>2005-04-27 00:00:00 -0600</ts:date>
>>   </trn:date-posted>
>>   <trn:date-entered>
>>     <ts:date>2005-04-27 12:26:51 -0600</ts:date>
>>   </trn:date-entered>
>>   <trn:description>Telus</trn:description>
>>   <trn:splits>
>>
>> Here is the first portion of another template transaction:
>> <gnc:transaction version="2.0.0">
>>   <trn:id type="guid">df0c8dbca68109b354d2b5cb035bf623</trn:id>
>>   <trn:currency>
>>     <cmdty:space>ISO4217</cmdty:space>
>>     <cmdty:id>CAD</cmdty:id>
>>   </trn:currency>
>>   <trn:date-posted>
>>     <ts:date>2005-09-08 00:00:00 -0600</ts:date>
>>   </trn:date-posted>
>>   <trn:date-entered>
>>     <ts:date>2005-09-08 12:10:41 -0600</ts:date>
>>   </trn:date-entered>
>>   <trn:description>Primerica</trn:description>
>>   <trn:splits>
>>
>> NOTE the missing <trn:currency> tag in the former.
>> PROBLEM: a missing XML tag has led to a failed data insert.
>>     
>
> Hmmm.  I have no clue why there was no currency.
>   
I think the interesting thing is that my XML file has, somehow, over 
time, developed this problem.  I started using gnucash with version 
1.8.x.  I can't even say when this may have developed.  However, gnucash 
tolerates this problem, with no noticeable ill effects.

I suppose the backend should add a default currency.  In the event of 
using multiple currencies, I am not sure how the choice should be made.  
Perhaps, it could be taken from the accounts involved in the scheduled 
transaction.

I wonder what other sorts of similar data problems there may be in other 
people's files that could cause troubles.  Probably some general means 
of dealing with it is required.  At the very least, detecting the failed 
insert and reporting it to the user is necessary.

Mark



More information about the gnucash-devel mailing list