Re: Implementing "thick"/"fat" databases

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Implementing "thick"/"fat" databases
Дата
Msg-id CD43890D-FB89-4E7E-AB7C-BDA30ACCD4B4@yahoo.com
обсуждение исходный текст
Ответ на Re: Implementing "thick"/"fat" databases  (Chris Travers <chris.travers@gmail.com>)
Ответы Re: Implementing "thick"/"fat" databases  ("Karl Nack" <karlnack@futurityinc.com>)
Список 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
buildup the staging table and then validate and transfer the data to the final table using a function.  In the example
youcan build a work-in-process transaction however you see fit but the final real transaction creation process would
firstconfirm that the entry balances before copying the records to the transaction table and cleaning up the
work-in-processtable. 

David J.



В списке pgsql-general по дате отправления:

Предыдущее
От: MirrorX
Дата:
Сообщение: Re: weird table sizes
Следующее
От: David Johnston
Дата:
Сообщение: Re: Implementing "thick"/"fat" databases