[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

1.5 , Adding conditional consistency check to acc_trans updating sql functions ?



Hello everyone,

Would it be of value to have following setting_key in defaults:

check_consistency : yes|no

After running a bug-fixing setup, one could for some time set this
value to true.

Every sql-function , updating acc_trans, could then check this setting_key and
if true , perform a function like:


  SELECT sum(amount) INTO balance FROM acc_trans
     WHERE trans_id = in_id
    HAVING sum(amount) <> 0;

   IF FOUND THEN
      RAISE WARNING 'Balance: %', balance;
      RAISE EXCEPTION 'Out of balance';
   END IF;


Herman