Trigger in partitioned table

From: Goboxe <hadzramin(dot)ar(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Trigger in partitioned table
Date: 2007-12-18 11:53:35
Message-ID: 446d4927-abac-487e-95b9-60076b993a35@e23g2000prf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

When adding sets of new child tables to a artitioned table, I need to
update the triggers with new dates added as new condition. See sample
below.

My question is, what will happen if the update to the trigger happen
at the same time as insert operation to the master table?

CREATE OR REPLACE FUNCTION t_agg_billing()
RETURNS "trigger" AS
$BODY$
DECLARE
BEGIN
IF (TG_OP = 'INSERT') THEN
IF NEW.CallDate = 20071001 THEN
INSERT INTO z_agg_billing_d_20071001 VALUES ( NEW.* );
ELSEIF NEW.CallDate = 20071002 THEN
INSERT INTO z_agg_billing_d_20071002 VALUES ( NEW.* );
ELSEIF NEW.CallDate = 20071003 THEN
INSERT INTO z_agg_billing_d_20071003 VALUES ( NEW.* );
...
...
...

END IF;
END IF;
RETURN NULL;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION t_agg_billing() OWNER TO sa;

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Terry Fielder 2007-12-18 11:54:42 Re: dblink does not connect when activated in a remote server
Previous Message Goboxe 2007-12-18 11:47:15 Partitioned tables & Slony