From: | "Karl Nack" <karlnack(at)futurityinc(dot)com> |
---|---|
To: | "Chris Travers" <chris(dot)travers(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Implementing "thick"/"fat" databases |
Date: | 2011-07-23 22:51:11 |
Message-ID: | 1311461471.6806.2155140981@webmail.messagingengine.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> In LedgerSMB, we take this a step further by making the procedures
> into discoverable interfaces, so the application logic itself is a
> sort of thin glue between a UI layer and the database procedure layer.
> One thing I would suggest is to try to keep API calls as atomic as
> possible. You want to enforce consistency and so you need to have all
> relevant inputs passed to the function. See below for a suggested
> change to your API.
Would you say LedgerSMB follows the thick/fat database principle? If so,
I shall have to spend some time with your source code. I'd be very
curious to see how you handle this.
> > BEGIN;
> > SELECT create_transaction(1, current_date, 'Transaction 1');
> > SELECT create_line_item(1, 1, 50);
> > SELECT create_line_item(1, 1, -50);
> > END;
>
> Now, if you are doing double-entry bookkeeping this doesn't provide
> enough consistency, IMO. You can't check inside the function to
> ensure that the transaction is balanced.
Yes, but I'd implement the constraint "all transactions must balance" as
a trigger that fires when the transaction is complete. This would
enforce data integrity regardless of whether or not the database API is
used, which I think is also important.
Karl Nack
Futurity, Inc
5121 N Ravenswood Ave
Chicago, IL 60640
773-506-2007
From | Date | Subject | |
---|---|---|---|
Next Message | Darren Duncan | 2011-07-23 22:58:12 | Re: Implementing "thick"/"fat" databases |
Previous Message | Karl Nack | 2011-07-23 22:39:31 | Re: Implementing "thick"/"fat" databases |