Re: Postgres Triggers issue

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: u235sentinel(at)gmail(dot)com
Cc: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres Triggers issue
Date: 2010-02-11 20:41:05
Message-ID: 4B746B61.5010003@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/11/2010 11:08 AM, u235sentinel wrote:
> Trigger function for an insert/update trigger should return "NEW", not
>>>> NULL (OLD - for "on delete" trigger):
>>> It's an AFTER TRIGGER, so the RETURN-Value ignored.
>>
>> According the doc:
>>
>> The return value of a BEFORE or AFTER statement-level trigger or an
>> AFTER row-level trigger is always ignored; it might as well be null.
>>
>> http://www.postgresql.org/docs/current/static/plpgsql-trigger.html
>>
>>
>> Andreas
> We found the problem. I did some additional digging and learned the
> admin in question was trying to trigger on a schema.table that didn't
> exist! Yeah I did slap him around a bit ;-)
>
> remembering the schema part of the name can be important!! ::grinz::
>
> One further question, so we're doing inserts from a remote source (it's
> a radware system feeding us data). Why would it stop the system from
> inserting data when it's an after statement? I noticed a bunch of
> 'connection time out' messages in our logs.
>
> It is working so I'm good. Still it is interesting the feed just stopped
> when the trigger was enabled.

Well that would depend on any number of factors. Without information on
how the feed is being done or more detailed logs it is hard to say for
sure. At a guess though, I would say it is because the 'feed' is being
done wrapped in a transaction and when the trigger errors it aborts the
transaction.

>
> Thanks!
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrej 2010-02-11 20:51:22 Re: error migrating database from 8.4 to 8.3
Previous Message John R Pierce 2010-02-11 20:01:15 Re: help with SQL join