On Thu, Aug 09, 2007 at 06:14:43PM +0200, Leif B. Kristensen wrote:
> On Wednesday 8. August 2007 15:12, Alban Hertroys wrote:
> >You should probably use a trigger (a before one maybe) instead of a
> > rule.
>
> I tried that too, but I'm still quite shaky on how to write triggers,
> and the same
On Wednesday 8. August 2007 15:12, Alban Hertroys wrote:
>You should probably use a trigger (a before one maybe) instead of a
> rule.
I tried that too, but I'm still quite shaky on how to write triggers,
and the same thing happened there: the inserted record was immediately
deleted. I solved the
On Wednesday 8. August 2007 15:12, Alban Hertroys wrote:
>Leif B. Kristensen wrote:
>> CREATE RULE placelimit AS
>> ON INSERT TO recent_places DO ALSO
>> DELETE FROM recent_places
>> WHERE
>> -- this clause doesn't work
>> -- (place_fk = NEW.place_fk AND id <> NEW.id) OR
>>
Leif B. Kristensen wrote:
> CREATE RULE placelimit AS
> ON INSERT TO recent_places DO ALSO
> DELETE FROM recent_places
> WHERE
> -- this clause doesn't work
> -- (place_fk = NEW.place_fk AND id <> NEW.id) OR
> id NOT IN (SELECT id FROM recent_places ORDER BY id DESC LIMIT 10
I found an excellent description of how to implement a fifo que in
PostgreSQL at Greg Mullane's blog:
http://people.planetpostgresql.org/greg/index.php?/archives/89-Implementing-a-queue-in-SQL-Postgres-version.html
I have used the 'rule' approach to implement a queue that generates a
quick-list