From: | u235sentinel <u235sentinel(at)gmail(dot)com> |
---|---|
To: | adrian(dot)klaver(at)gmail(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
Subject: | Re: Postgres Triggers issue |
Date: | 2010-02-12 04:23:08 |
Message-ID: | 4B74D7AC.8070804@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Adrian Klaver wrote:
> On Thursday 11 February 2010 1:57:39 am Albe Laurenz wrote:
>
>> u235sentinel wrote:
>>
>>> I have a strange problem we noticed the other day with
>>> triggers. We're
>>> running 8.3.3 on Solaris 10 (intel) and have a feed that comes in
>>> regularly to populate a table we're working on. The feed works just
>>> fine inserting rows however the following trigger stops the feed until
>>> we remove the trigger. Any thoughts on what I'm doing wrong here?
>>>
>>> Thanks!
>>>
>>> ---
>>>
>>> CREATE OR REPLACE FUNCTION r.m_t()
>>> RETURNS trigger AS
>>> $BODY$
>>> BEGIN
>>> INSERT INTO temp_m_t VALUES (NEW.*,1+1);
>>> RETURN NULL;
>>> END;
>>> $BODY$
>>> LANGUAGE 'plpgsql';
>>>
>>>
>>> CREATE TRIGGER tafter
>>> AFTER INSERT OR UPDATE
>>> ON r.m_a
>>> FOR EACH ROW
>>> EXECUTE PROCEDURE r.m_t();
>>>
>> What do you mean "stops the feed"?
>>
>> Can you describe the behaviour in database terms?
>> What exactly happens, and how does it differ from what you expect?
>> Are there error messages? If yes, could you quote them?
>>
>> Yours,
>> Laurenz Albe
>>
>
> In addition to the above I am not quite sure about this:
>
> INSERT INTO temp_m_t VALUES (NEW.*,1+1)
>
> Are you trying to have an incrementing number for the last value? As it stands
> you are are always going to get 2 inserted into that field.
>
>
Yes this was intentional for testing purposes. We were trying to see if
we can do it and it worked. Now we can get into the really fun stuff :-)
Thanks to all for their help!
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-02-12 05:08:35 | Re: "like any" in reverse? |
Previous Message | Gauthier, Dave | 2010-02-12 03:03:53 | "like any" in reverse? |