Re: Trigger - will not perform INSERT

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Trigger - will not perform INSERT
Дата
Msg-id 7F144964-F66E-4D37-B17C-24CDFE6FDB56@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на Trigger - will not perform INSERT  (smiley2211 <smiley2211@yahoo.com>)
Ответы Re: Trigger - will not perform INSERT  (smiley2211 <msramsey22@gmail.com>)
Список pgsql-general
On Dec 11, 2007, at 21:35, smiley2211 wrote:

>
> ex:
>
> CREATE TRIGGER mytrig AFTER INSERT OR UPDATE ON foo1 FOR EACH ROW
> EXECUTE
> PROCEDURE updatefoo1('datarow');
>
> The command itself is able to be executed without error. However,
> what then
> happens, is that whenever the application attempts to insert a
> record into
> foo1, it simply doesn't insert. Once I take the trigger off, it beings
> inserting again.
>
> I have checked permissions but INSERT only FAILS while trigger is
> enabled..
>
> Thanks...Michelle

This would be expected behaviour if the trigger were a BEFORE INSERT
one (instead of AFTER) and the procedure returned NULL. You might
want to check that is really not the case.

AFTER INSERT triggers don't fire until the row is actually inserted
into the table, so the only possibility I can see for the behaviour
you describe is that the stored procedure removes the record that was
just inserted.
Maybe there are statements in that procedure that attempt to remove
possible duplicates that also happen to match on the new record?

Regards,
--
Alban Hertroys

                "If you throw your hands up in the air,
                how're you gonna catch them?"




!DSPAM:737,475fc5969651302216542!



В списке pgsql-general по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Hijack!
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: very slow query