using PostgreSQL

John Ralls jralls at ceridwen.us
Sun Jan 12 10:19:05 EST 2014


On Jan 12, 2014, at 6:18 AM, Christian Eichert <gnucash at zp1.net> wrote:

> I am reading here in the Documentation:
> 
>   GnuCash by default stores data in an *xml* format. Starting with
>   version 2.4, GnuCash financial data can be stored in a *SQL
>   database* using *SQLite3*, *MySQL* or *PostgreSQL*.
> 
> But there is no further word spent about this important features.
> 
> Can Someone tell me how to enable the default storage in PostgreSQL format ?

There's no such thing as "Postgresql format". You can store your data in Postgresql server by installing libdbd-pgsql (or whatever it's called on your distro); that's not necessary on Windows and not feasible on OSX. Then you need a running Postgresql server to use. Setting that up and administering it is beyond the scope of this forum. Once you have libdbd-pgsql installed, the File>Save As dialog box will include the Postgresql option in the type listbox at the top.

As David notes separately, the SQL backend is simply a persistence store. The entire database is still loaded into memory at open; the only difference is that most changes are stored immediately rather than lighting up the Save button. As he also notes, that "most" is a catch: In our current design it's all too easy to change an object's state and not flag it for saving; the XML backend gets around this by flushing all objects to a new file at every save. We've audited the code and *think* we've fixed all of the places where state was changed without a save, but we don't have adequate test coverage to be sure, so we can't recommend that you use the SQL backends for production data unless you thoroughly test all of the features you intend to use first.

Another caution: All of the business logic is in the program. There is nothing in the DB except tables, not even foreign keys, so while you may query to your heart's content, you must *never* update or insert from outside of GnuCash unless you use the GnuCash API, provided in C, Scheme, and Python.

Regards,
John Ralls




More information about the gnucash-user mailing list