postgres development

Roland Roberts roland at
Thu Mar 6 13:53:04 CST 2003


>>>>> "Andrew" == Andrew Pimlott <gnucash-devel at> writes:

    Andrew> I expect you can find a way to enforce most of them in the
    Andrew> database, although it may be awkward in SQL, and you would
    Andrew> be duplicating the same constraints in the code.  But how
    Andrew> onerous are these invariants?  Obviously, splits must
    Andrew> balance, and there are probably (?) some limitations on
    Andrew> which kinds of splits can go in which kinds of accounts.
    Andrew> Am I missing a lot?

I can't answer you final question, but the constraints can be managed
in PostgreSQL via triggers.  I have added similar trigger-based
constraints to recalculate certain columns values based on other
columns' values.  The use of triggers will prevent the use of less
feature-complete databases, but the major RDBMS products will all have
triggers and stored procedures (although every one of them will be

However, how much of that do you really want to push into the
database?  Right now, the XML file doesn't enforce any
constraints/invariants; that's done by the front-end and the back-end
is "merely" a storage container.  Pushing the constraints into the
backend makes it possible to maintain consistency even with a badly
written alternate front-end application, but is that something you
want to worry about?  If it is, then triggers will do the trick.


- -- 
		       PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                             RL Enterprises
roland at                            6818 Madeline Court
roland at                           Brooklyn, NY 11220

Version: 2.6.3ia
Charset: noconv
Comment: Processed by Mailcrypt 3.5.4, an Emacs/PGP interface


More information about the gnucash-devel mailing list