Re: Modified FIFO queue and insert rule

From: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Modified FIFO queue and insert rule
Date: 2007-08-09 16:14:43
Message-ID: 200708091814.43789.leif@solumslekt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 problem temporarily with two lines in PHP:

function set_last_selected_place($place) {
pg_query("DELETE FROM recent_places WHERE place_fk = $place");
pg_query("INSERT INTO recent_places (place_fk) VALUES ($place)");
}

As my application is single-user, and everything is already wrapped up
in a transaction anyway, there's no real problem with this. But I'd
still like to understand how to do it 'properly' inside the DB.
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE
My Jazz Jukebox: http://www.last.fm/user/leifbk/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Woody Woodring 2007-08-09 16:14:46 Bytea question with \208
Previous Message Tom Lane 2007-08-09 15:59:53 Re: [JDBC] Restore database from zipped textfile (.sql) created by pg_dumpall