Yan Cheng Cheok <yccheok(at)yahoo(dot)com> 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:
> RETURN NULL;
That's suppressing the INSERT action.
regards, tom lane