GNOME Bugzilla – Bug 598618
does not calculate account balances correctly
Last modified: 2018-06-29 22:29:53 UTC
Created attachment 145556 [details] Accounts showing $650 Invoice -- Running Postgresql 8.3.8 -- Entered customer "Allstate Insurance Co." -- Entered invoice for $650 -- File -->Save As -->Postgresql (entered db name, db user and db password) See screen shot "Accounts showing $650 Invoice" -- File -->Quit
Created attachment 145557 [details] Balances mysteriously get changed to $1300
Re-entering Gnucash, balances mysteriously get changed to $1300.
Created attachment 145559 [details] Transaction show $650 but balance is $1300 See third screenshot showing one $650 transaction but the balance is $1300
Created attachment 145560 [details] Your humble reporter on the beach at Waikiki
I like the picture. The only thing I can think of is that the initial balance query is not working correctly. With an XML file is opened, all of the transactions are read into memory. The accounts start with start balance of 0 and the end balance is the sum of the amounts of all splits for the account. With the sql backend, all transactions are *not* loaded at start time. Instead, there's a query for the sum of all split amounts for each account, and this is set as the account balance shown on the accounts page. As splits are loaded for an account, the start balance is adjusted by the amount of new splits so that the end balance stays constant. As an example, if there is 1 split worth $650 in the db for an account, it sets the start balance on startup to $650. Since there are no splits, the end balance is also $650. Then, when the splits for that account are loaded, the end balance changes to $1300, and the start balance is offset by $1300-$650 (new end balance - old end balance) to bring the end balance back to the correct value. Perhaps this is going wrong somehow. Can you package the db and e-mail it to me?
I emailed a pg_dump to the return address of your email. If there is a different email address, kindly forward that to me. Good luck!
I got the file and see the issue. Now to track down the cause.
Found the cause. Not sure of the solution. It's another issue related to not loading all splits on startup.
Phil, just remember what I tell my Linux students at University of Phoenix: "There is ALWAYS time to do it right." Just take your time and think it through.
r18431 - Reverted back to loading all splits/transactions on startup.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=598618. Please update any external references or bookmarks.