postgres development

Andrew Pimlott gnucash-devel at andrew.pimlott.net
Sat Mar 22 16:09:39 CST 2003


[Sorry for the late reply.]

On Thu, Mar 06, 2003 at 06:18:58PM -0600, Matthew Vanecek wrote:
> 
> On 6 Mar 2003, Roland Roberts wrote:
> 
> > 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
> > different).
> 
> This is entirely true.  Calculated fields, however, are a blatant and 
> egregious violation of BCNF.

This is not true if the calculated "fields" are in a view that the
database is told to keep updated.  Unfortunately, databases tend not
to support that.

> In general, calculations should be left up 
> to the application, and data storage and integrity is the realm of the 
> RDBMS.

If databases had good support for transparently updating calculated
values on-the-fly, the situation would be different, I think.  It is
not inherently outside the reams of the DBMS.

> That's true.  But the dbms is there to enforce the relationships, not the 
> validity (e.g., each Split belongs to a Transaction.

What do you consider the difference between "integrity" and
"validity"?  There is none, fundamentally.  There's no reason not to
have the DBMS enforce full validity, except that it is too
cumbersome and may not perform well.  But within those constraints,
we might as well enforce as much as feasible.

Andrew


More information about the gnucash-devel mailing list