title: Problem in calling postgres function from .net
body: <p>I have a function of day closing in postgresql</p>
  <pre><code>CREATE OR REPLACE FUNCTION transactions.start_eod_operation(
      value_date_ date,
      user_id_ integer)
      RETURNS void
      LANGUAGE 'plpgsql'
  
      COST 100
      VOLATILE 
  AS $BODY$
  BEGIN
      IF NOT EXISTS(SELECT * FROM core.day_operation WHERE is_eod_completed = false AND value_date = value_date_) THEN
          RAISE EXCEPTION 'BOD for this date was never started.';
      END IF;
  
      IF EXISTS(SELECT * FROM transactions.transactions WHERE verification_status_id = 0) THEN
          RAISE EXCEPTION 'Voucher(s) pending for verification, cannot perform EOD!';
      END IF;
  
      DELETE FROM history.balance_holder WHERE value_date::date = value_date_;
      INSERT INTO history.balance_holder(office_id, account_number_id, value_date, balance, minimum_balance, audit_user_id)
      SELECT 1, t.account_number_id, value_date_, SUM(COALESCE(t.credit,'0') - COALESCE(t.debit, '0')), p.minimum_balance, user_id_
      FROM deposit.transaction_view t
      INNER JOIN deposit.account_holders a ON a.account_number_id = t.account_number_id
      INNER JOIN core.deposit_products p ON a.deposit_product_id = p.deposit_product_id
      WHERE t.value_date &lt;= value_date_
      GROUP BY  t.account_number_id, p.minimum_balance;
  
      PERFORM deposit.post_interest_transit(value_date_, user_id_);
  
      PERFORM deposit.auto_transfer_interest(value_date_, user_id_);
  
      PERFORM deposit.auto_transfer_fd($1, $2);
  
      PERFORM loan.post_interest_transit(value_date_);
      
  
      UPDATE core.day_operation SET is_eod_completed = true, eod_started_on=NOW(), eod_user_id = user_id_ WHERE value_date = value_date_;
  
  END
  $BODY$;
  </code></pre>
  <p>When user begin day close process from software</p>
  <p>PERFORM deposit.post_interest_transit(value_date_, user_id_);  this function or command in this function run twice a day not every day when there is problem in connection or server computer performance or in normal condition too. Inside this
  PERFORM deposit.post_interest_transit(value_date_, user_id_); function there is delete command if there is data exist in that day and only begin insert command but it inserting 2 times in table. There is not any problem if I ran this function directly from database twice or more. What is the solution is this postgres bug or web browser bug ?</p>