Subject | [ib-support] Re: more deadlocks |
---|---|
Author | Lauri Zoova |
Post date | 2002-12-21T00:34:49Z |
Pavel Cisar wrote:
solution :((
count_calc computed by (count - (select sum(s.count) from sold_products
s where s.id = id))?
This is a new approach worth exploring. Thanks Pavel.
BR,
Lauri
>>I have a table with products(id, name, count) and another table withI'd call it a trap. This looked like the most obvious and simple
>>sold_products(id, name, count, invoiceno.. etc). sold_products has a
>>trigger that fires on table insertions. It updates the count of products
>>in products table.
>
> Well, you have shoot yourself to the knees :)
solution :((
> The better approach is to never do an update connected with insertYou mean, to add a computed field to products. something like - add
> operation. In your case, you can sum() count of products sold from
> sold_products on demand.
> [...]
count_calc computed by (count - (select sum(s.count) from sold_products
s where s.id = id))?
This is a new approach worth exploring. Thanks Pavel.
BR,
Lauri