Gnucash and root-account in MySQL

Colin Law clanlaw at googlemail.com
Sun Aug 9 03:01:07 EDT 2009


2009/8/9 Marcus Wolschon <Marcus at wolschon.biz>:
> On Sat, Aug 8, 2009 at 6:07 PM, Phil Longstaff<plongstaff at rogers.com> wrote:
[...]
>> My memory is that the root account is a pseudo-account. I have no problem
>> adding it to the accounts in the table. I may also have omitted it because
>> it would require parent-guid = NULL, and I wanted to keep that check.
>>
>> So, proposal:
>> 1) accounts table remove restriction that parent-guid != NULL
>> 2) add ROOT account to the table with parent-guid = NULL
>
> You do not have to remove the restriction "parent_guid != NULL"
> if you define that an account that has guid = parent_guid is a root-
> account. (If multiple of these exist, then there are multiple books.
> They cannot lead to circles in the account-tree as they have no
> parent and are thus never children of anything.)
>

If I had a vote I would vote for parent_guid = nil for root account.
This maps to the real world better (ie account that has no parent)
rather than an account that is its own parent being a root account.
Also using the latter approach a root account would appear in a query
selecting all of its children (all accounts whose parent is the root
account) which would require special case handling.

Colin


More information about the gnucash-devel mailing list