Re: problems with date

From: Richard Huxton <dev(at)archonet(dot)com>
To: Jamie Deppeler <jamie(at)doitonce(dot)net(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: problems with date
Date: 2004-12-21 09:03:34
Message-ID: 41C7E6E6.2030102@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jamie Deppeler wrote:
> Hi,
>
> having a small problem in a trigger i want to automatically update a
> date field but when i use for example
>
> update table
> set field = current_date
> where table.pk = new.pk

If "table" is the table with the trigger on it, you'll end up with an
endless loop, since the trigger will keep firing itself.

In a BEFORE trigger, just update NEW and make sure you return NEW. Look
at the example in the manual for details.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-12-21 09:24:09 Re: weird run-times with pg_autovacuum
Previous Message Russ Brown 2004-12-21 07:52:31 Re: RES: NewsForge Poll: Favorite open source database?