Re: problems with date - Mailing list pgsql-general

From Richard Huxton
Subject Re: problems with date
Date
Msg-id 41C7E6E6.2030102@archonet.com
Whole thread Raw
In response to problems with date  (Jamie Deppeler <jamie@doitonce.net.au>)
List 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

pgsql-general by date:

Previous
From: Russ Brown
Date:
Subject: Re: RES: NewsForge Poll: Favorite open source database?
Next
From: Richard Huxton
Date:
Subject: Re: weird run-times with pg_autovacuum