From: | Yan Cheng Cheok <yccheok(at)yahoo(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Problem after installing triggering function |
Date: | 2010-01-28 00:53:59 |
Message-ID: | 4945.95161.qm@web65710.mail.ac4.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks and Regards
Yan Cheng CHEOK
--- On Thu, 1/28/10, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> Subject: Re: [GENERAL] Problem after installing triggering function
> To: "Yan Cheng Cheok" <yccheok(at)yahoo(dot)com>
> Cc: pgsql-general(at)postgresql(dot)org
> Date: Thursday, January 28, 2010, 12:34 AM
> 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:
>
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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Yan Cheng Cheok | 2010-01-28 01:10:31 | Re: Primary Key Increment Doesn't Seem Correct Under Table Partition |
Previous Message | A B | 2010-01-28 00:45:11 | How much work is it to add/drop columns, really? |