diff options
| -rw-r--r-- | sql/dawn.sql | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 12e97e9e..73ee564f 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -507,11 +507,11 @@ CREATE TABLE account_counterparty ( ); -CREATE OR REPLACE FUNCTION update_account(p_trade_type) +CREATE OR REPLACE FUNCTION update_account() RETURNS TRIGGER AS $$ BEGIN -SELECT cash_account INTO STRICT NEW.cash_account FROM accounts2 LEFT JOIN account_counterparty ON accounts2.id=account_id WHERE trade_type=p_trade_type AND fund=NEW.fund AND account_counterparty.cp_code=NEW.cp_code; +SELECT cash_account INTO STRICT NEW.cash_account FROM accounts2 LEFT JOIN account_counterparty ON accounts2.id=account_id WHERE trade_type=TG_ARGV[0] AND fund=NEW.fund AND account_counterparty.cp_code=NEW.cp_code; RETURN NEW; END $$ LANGUAGE plpgsql; |
