String lengths in the SQL backend

Derek Atkins warlord at MIT.EDU
Fri Nov 14 08:30:11 EST 2008


Phil Longstaff <plongstaff at> writes:

> On November 13, 2008 10:10:53 am Derek Atkins wrote:
>> What exactly is the use-case for using codes as a primary key?
>> Keep in mind that the SQL Backend data store is just that, a
>> data store.  GnuCash does NOT use database constraints, and
>> for Accounts it doesn't even need to use an Index, because GnuCash
>> does (should!) load in all the accounts at start time.
>> So... All searches on accounts are done in core in the gnucash app
>> without looking at the DB backend.
> The use case is that one person wants to have another table which
> stores information based on the account code.  I gather there are
> standard German account codes and he wants to key off of them.
> Possible alternatives are to key off of the account guid, or have a
> code key but don't require the code key in his table to be 2048
> long.

I must have missed this, because I don't remember reading the original
request.  I don't understand what "additional table" is required.
I'm trying to think about it from the GnuCash use standpoint, not
the backend storage aspect.  Where in GnuCash is this extra "table"
supposed to be used?  And how?

> BTW, Derek is right that the SQL backend is simply a data store.
> When you open an SQL db, the entire contents is read in the same way
> the current XML file is read.  Any time you add/delete/edit
> anything, the change is written to the db immediately, so it should
> help prevent data loss.  Gnucash is not written as a database app.
> It is written assuming that all data is immediately available.
> Having an SQL db will open up possibilities, but the app will need a
> lot of work to make use of those possibilities.

Wait, the ENTIRE contents are read in?  Historically only "necessary
data" was read in.  That would be the Accounts and Commodities from
the main CoA.  The transactions were all loaded on demand.

> Phil

> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL:    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-user mailing list