From: | Russell Smith <mr-russ(at)pws(dot)com(dot)au> |
---|---|
To: | Michail Antonov <atin65536(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #5319: recursion in the triggers |
Date: | 2010-02-09 07:31:11 |
Message-ID: | 4B710F3F.9000706@pws.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Michail Antonov wrote:
> The following bug has been logged online:
>
> Bug reference: 5319
> Logged by: Michail Antonov
> Email address: atin65536(at)gmail(dot)com
> PostgreSQL version: 8.4.2
> Operating system: Windows XP
> Description: recursion in the triggers
> Details:
>
> I have 'after insert' trigger, which call function, which insert row in the
> same table. I expect, that trigger will be called again, but it does not
> heppened.
>
> Reply me, is it a bug or feature?
>
>
I would argue this is a feature. Foreign keys are implemented as
triggers. There are many cases where you want rows inserted on triggers
to also run checks on the data for validity and those are usually
written in triggers.
If you need to protect against this, you will need to use the NEW row to
find out if it's one of the automatically inserted rows. If that's the
case, don't do anything.
Regards
Russell
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2010-02-09 19:47:23 | Re: unable to fail over to warm standby server |
Previous Message | Devrim GÜNDÜZ | 2010-02-08 16:37:00 | Re: [Pgsqlrpms-hackers] weird bug in rebuilding RPMs |