Thanks and Regards Yan Cheng CHEOK --- On Thu, 1/28/10, Tom Lane <tgl@xxxxxxxxxxxxx> wrote: > From: Tom Lane <tgl@xxxxxxxxxxxxx> > Subject: Re: Problem after installing triggering function > To: "Yan Cheng Cheok" <yccheok@xxxxxxxxx> > Cc: pgsql-general@xxxxxxxxxxxxxx > Date: Thursday, January 28, 2010, 12:34 AM > Yan Cheng Cheok <yccheok@xxxxxxxxx> > writes: > > I have a stored procedure execute the following code > : > > INSERT INTO unit(fk_lot_id, > cycle) > > VALUES(_lotID, _cycle) > RETURNING * INTO _unit; > > raise notice 'AFTER INSERT > INTO UNIT, _unit.unit_id = %', _unit.unit_id ; > > > unit_id column, is an auto generated primary key. I > will always get a non-null value. > > > However, after I install a trigger function, and > create a table named unit_0 inherit from table unit, > > > NOTICE: AFTER INSERT INTO UNIT, > _unit.unit_id = <NULL> > > > will be printed. > > If you installed it as a BEFORE trigger, the problem is > here: > You are right. I am inserting BEFORE trigger. CREATE TRIGGER insert_unit_trigger BEFORE INSERT ON unit FOR EACH ROW EXECUTE PROCEDURE unit_insert_trigger(); > > RETURN NULL; > > That's suppressing the INSERT action. > > But... I am not implementing table partition. I want to ensure my parent table "unit" is empty, and "unit_0" is being filled. But, all my query can be performed through parent table "unit". I am referring to http://www.if-not-true-then-false.com/2009/11/howto-create-postgresql-table-partitioning-part-1/ > regards, tom lane > > -- > Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general