Re: Problem after installing triggering function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yan Cheng Cheok <yccheok(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem after installing triggering function
Date: 2010-01-27 16:34:45
Message-ID: 7946.1264610085@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aycock, Jeff R. 2010-01-27 16:41:58 Re: syntax error during function call
Previous Message Andreas Kretschmer 2010-01-27 16:34:35 Re: syntax error during function call