Re: Some one plz help me (MAHENDRA D RATHOD)

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Ramesh PAtel <ramesh(at)banas(dot)guj(dot)nic(dot)in>
Cc: pgsql-admin(at)postgresql(dot)org, mahim_engg_2003(at)yahoo(dot)com
Subject: Re: Some one plz help me (MAHENDRA D RATHOD)
Date: 2003-05-12 11:48:00
Message-ID: 1052740079.18710.7.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, 2003-05-12 at 11:53, Ramesh PAtel wrote:
> My self is Mahendra D Rathod.
>
> I have some problem in executing trigger at backend side
>
> One trigger is fired AFTER INSERT OR UPDATE ON mtrl_issue_detail
>
> So when any row of "mtrl_issue_detail" is inserted or updated this
> trigger is fired on one function.
>
> This function updates the same row that has just been inserted or
> updated.
>
> Now when this process happens the database gets HANGED. and i have to
> restart the database on server.

This is hardly surprising, because you have explicitly set up an
infinite loop.

If you wish to change the record being updated or inserted, you should
use a BEFORE trigger, change NEW (the record to be inserted or the
after-update record) and return NEW.

Check the documentation:
Programmer's Manual
Procedural Languages
PL/pgSQL
Trigger procedures

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Study to show thyself approved unto God, a workman
who does not need to be ashamed and who correctly
handles the word of truth." II Timothy 2:15

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2003-05-12 14:32:40 Re: No flamefest please, MySQL vs. PostgreSQL AGAIN
Previous Message Ramesh PAtel 2003-05-12 10:53:26 Some one plz help me (MAHENDRA D RATHOD)