Re: Implementing "thick"/"fat" databases

From: David Johnston <polobo(at)yahoo(dot)com>
To: Chris Travers <chris(dot)travers(at)gmail(dot)com>
Cc: Karl Nack <karlnack(at)futurityinc(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Implementing "thick"/"fat" databases
Date: 2011-07-23 20:10:59
Message-ID: CD43890D-FB89-4E7E-AB7C-BDA30ACCD4B4@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>
> 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. it would be better to:
>
> BEGIN;
> SELECT create_transaction(1, current_date, 'Transaction 1', '{{1, 1,
> 50},{1,1,-50}}');
> COMMIT;
>
> Now for the application, you can create an API that is semantically
> clearer. But PostgreSQL doesn't provide an easy way of calling
> procedures of this sort out of select/update/insert statements and
> select is the only way to do this.
>
>

One option to consider is restricting final tables but making staging tables available. You use normal inserts to build up the staging table and then validate and transfer the data to the final table using a function. In the example you can build a work-in-process transaction however you see fit but the final real transaction creation process would first confirm that the entry balances before copying the records to the transaction table and cleaning up the work-in-process table.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-07-23 20:32:59 Re: Implementing "thick"/"fat" databases
Previous Message MirrorX 2011-07-23 19:18:25 Re: weird table sizes