触发关闭pg管理员?

时间:2015-12-15 09:13:42

标签: postgresql triggers pgadmin

我在INSERT上创建了一个触发器 fk_pay_trigger

CREATE TRIGGER fk_pay_trigger
BEFORE INSERT ON fk_payment_temp
FOR EACH ROW
EXECUTE PROCEDURE add_insert_trigger_fk()

和功能附件是:

-- Function: add_insert_trigger_fk()

-- DROP FUNCTION add_insert_trigger_fk();

CREATE OR REPLACE FUNCTION add_insert_trigger_fk()
  RETURNS trigger AS
$BODY$
Declare 

begin 
    if (TG_TABLE_NAME = 'fk_payment_temp') then 
        if (TG_OP = 'INSERT') then
            Insert into fk_payment_temp_backup values(now(),NEW.settlement_ref_no, NEW.order_type, NEW.fulfilment_type, NEW.seller_sku, NEW.wsn, 
                   NEW.order_id, NEW.order_item_id, NEW.order_date, NEW.dispatch_date, NEW.delivery_date, 
                   NEW.cancellation_date, NEW.settlement_date, NEW.order_status, NEW.quantity, NEW.order_item_value, 
                   NEW.sale_transaction_amount, NEW.discount_transaction_amount, NEW.refund, 
                   NEW.protection_fund, NEW.total_marketplace_fee, NEW.service_tax, NEW.settlement_value, 
                   NEW.commission_rate, NEW.commission, NEW.payment_rate, NEW.payment_fee, NEW.fee_discount, 
                   NEW.cancellation_fee, NEW.fixed_fee, NEW.emi_fee, NEW.total_weight, NEW.shipping_fee, 
                   NEW.reverse_shipping_fee, NEW.shipping_zone, NEW.token_of_apology, NEW.pick_and_pack_fee, 
                   NEW.storage_fee, NEW.removal_fee, NEW.invoice_id, NEW.invoice_date, NEW.invoice_amount, 
                   NEW.sub_category, NEW.total_offer_amount, NEW.my_offer_share, NEW.flipkart_offer_share);
            return NEW;
        END if;
    End if ;
    return null;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

工作正常。但问题是:

触发器执行时。 PG管理员自动关闭。

我不知道发生了什么。我的代码或问题是否有问题?

0 个答案:

没有答案