Trigger does not behave as expected
От | Goboxe |
---|---|
Тема | Trigger does not behave as expected |
Дата | |
Msg-id | 3874a4e2-e310-4158-9c55-16b4e11ec5e6@x35g2000hsb.googlegroups.com обсуждение исходный текст |
Ответы |
Re: Trigger does not behave as expected
|
Список | pgsql-general |
Hi, I have a trigger as below. I am wondering why when I tried to insert to master table with date= 20080908, the trigger does not insert to z_agg_tmcarr_pfx_gtwy_cc_w_20080908. Is that something wrong with the statement "ELSEIF NEW.CallDate >= 20080908 AND NEW.CallDate <= 20080914 THEN"? -------------------------------------------------- CREATE OR REPLACE FUNCTION t_agg_tmcarr_pfx_gtwy_cc() RETURNS "trigger" AS $BODY$ DECLARE BEGIN IF (TG_OP = 'INSERT') THEN IF NEW.CallDate >= 20080901 AND NEW.CallDate <= 20080907 THEN INSERT INTO z_agg_tmcarr_pfx_gtwy_cc_w_20080901 VALUES ( NEW.* ); ELSEIF NEW.CallDate >= 20080908 AND NEW.CallDate <= 20080914 THEN INSERT INTO z_agg_tmcarr_pfx_gtwy_cc_w_20080908 VALUES ( NEW.* ); ELSEIF NEW.CallDate >= 20080915 AND NEW.CallDate <= 20080921 THEN INSERT INTO z_agg_tmcarr_pfx_gtwy_cc_w_20080915 VALUES ( NEW.* ); END IF; END IF; RETURN NULL; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; ALTER FUNCTION t_agg_tmcarr_pfx_gtwy_cc() OWNER TO sa;
В списке pgsql-general по дате отправления: